Java XML中的backgroundTint不会更改BottomActionBar的颜色,即使使用min API>;=21

Java XML中的backgroundTint不会更改BottomActionBar的颜色,即使使用min API>;=21,java,android,material-components,material-components-android,android-bottomappbar,Java,Android,Material Components,Material Components Android,Android Bottomappbar,我正在尝试设置一个带有浮动操作按钮的基本底部操作栏。目前,除了酒吧的背景,一切似乎都正常。如果我使用android:background=“some_background_color”,则该栏将填充所需的颜色 问题是我希望我的晶圆厂被包围,而这种方法似乎与fabCradleMargin和fabCradleRoundedCornerRadius不兼容,因为修改这些值不会影响背景栏 所有教程都指出,app:backgroundTint=“some\u background\u color”是一个不错

我正在尝试设置一个带有浮动操作按钮的基本底部操作栏。目前,除了酒吧的背景,一切似乎都正常。如果我使用android:background=“some_background_color”,则该栏将填充所需的颜色

问题是我希望我的晶圆厂被包围,而这种方法似乎与
fabCradleMargin
fabCradleRoundedCornerRadius
不兼容,因为修改这些值不会影响背景栏

所有教程都指出,app:backgroundTint=“some\u background\u color”是一个不错的选择,但我的操作栏不受此影响。我已经将API设置为>=21,据我所知,没有任何问题

我的XML文件:

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
    tools:context=".MainActivity">

    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_constraintBottom_toBottomOf="parent">

        <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/bottom_app_bar"
            style="@style/Widget.MaterialComponents.BottomAppBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            app:backgroundTint="@color/colorPrimary"
            app:fabAlignmentMode="center"
            app:fabAttached="true"
            app:fabCradleMargin="10dp"
            app:fabCradleRoundedCornerRadius="10dp" />

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fab"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_add_white_24dp"
            app:layout_anchor="@+id/bottom_app_bar"
            app:layout_anchorGravity="center_horizontal"
            app:fabSize="normal"/>

    </androidx.coordinatorlayout.widget.CoordinatorLayout>

</androidx.constraintlayout.widget.ConstraintLayout>

背景色对酒吧没有影响;它仍然是完全白色的

抱歉,如果这是一个基本问题;我对Android非常陌生,花了相当长的时间寻找解决方案,但毫无结果。

我测试了你的代码 它显示了
BottomAppBar
的错误,因此我发现此代码
app:fabAttached=“true”
未定义

拆下它,它将完美工作。 祝你好运。

我测试了你的代码 它显示了
BottomAppBar
的错误,因此我发现此代码
app:fabAttached=“true”
未定义

拆下它,它将完美工作。
祝好运。

应用程序:backgroundTint=“@color/…”
有效。使用版本1.1.0-beta01我使用的是1.1.0-beta01,而
app:backgroundTint=“@color/…”
在我这边不起作用。
app:backgroundTint=“@color/…”
起作用。使用版本1.1.0-beta01我使用的是1.1.0-beta01,而
app:backgroundTint=“@color/…”
在我这方面不起作用。