BottomNavigationBar 中的隐形背景

发布于 2025-01-17 23:42:55 字数 1382 浏览 1 评论 0原文

我想设置背景透明,但是我已经尝试了所有内容,但我无法设置它。我在此处让我的XML代码和单元格的图片:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MenuPrincipalActivity" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/frame_layout"/>

    <com.etebarian.meowbottomnavigation.MeowBottomNavigation
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:mbn_backgroundBottomColor="#FFFFFF"
        app:mbn_circleColor="@color/whiteTextColor"
        app:mbn_countBackgroundColor="#ff6f00"
        app:mbn_countTextColor="@color/whiteTextColor"
        app:mbn_defaultIconColor="@color/black"
        app:mbn_selectedIconColor="@color/black"
        android:background="@null"/>

</LinearLayout>

如果您看到照片,您可以看到背景不是背景。在XML中,如果我更改了bottomNavigationbar的背景颜色它会更改,但是我确实尝试了所有内容,但是我无法设置透明的背景。

I want to set the background transparent, but I've tried everything and I can't set it. I let my XML code and a pic of the cell here:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MenuPrincipalActivity" >

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:id="@+id/frame_layout"/>

    <com.etebarian.meowbottomnavigation.MeowBottomNavigation
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:mbn_backgroundBottomColor="#FFFFFF"
        app:mbn_circleColor="@color/whiteTextColor"
        app:mbn_countBackgroundColor="#ff6f00"
        app:mbn_countTextColor="@color/whiteTextColor"
        app:mbn_defaultIconColor="@color/black"
        app:mbn_selectedIconColor="@color/black"
        android:background="@null"/>

</LinearLayout>

If you see the photo, you can see that the background isn't background. In the XML, if I change the background color of BottomNavigationBar it changes, but I really tried with everything, but I'm not able to set the transparent background.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

Spring初心 2025-01-24 23:42:55

您正在使用 MeowBottomNavigation,通过快速搜索,您可以在这里看到,有人已经要求提供同样的事情 #21

所以试试这个:

android:background="@android:color/transparent"

You're using a MeowBottomNavigation, with quick search, you can see here, that someone already ask for the same thing #21

So try this :

android:background="@android:color/transparent"
清风不识月 2025-01-24 23:42:55

与其将背景设置为透明颜色,不如创建一个透明的矩形,例如:

drableable \ parraparent_rect.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#00000000" />
</shape>

,然后将其设置为android:background

<com.etebarian.meowbottomnavigation.MeowBottomNavigation
    ...
    android:background="@drawable/transparent_rect"/>

Instead of setting the background to a transparent color, create a transparent Rectangle drawable like:

drawable\transparent_rect.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >
    <solid android:color="#00000000" />
</shape>

Then set that to android:background

<com.etebarian.meowbottomnavigation.MeowBottomNavigation
    ...
    android:background="@drawable/transparent_rect"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文