我想让我的导航视图的背景是#121212,但是它变成了一个更浅的灰色。然而,当应用相同的颜色作为背景时,视图中的项目会显示正确的颜色。
android:background="@color/navview"
app:itemBackground="@color/navview"
Run Code Online (Sandbox Code Playgroud)
测试项的背景设置为与导航视图背景相同的颜色,但是如下所示的颜色存在惊人的差异。
导航视图背景是否有过滤器?我尝试通过将背景色调模式设置为空来禁用它,
nvView.backgroundTintMode = null
Run Code Online (Sandbox Code Playgroud)
然而它似乎没有效果。任何帮助表示赞赏!
编辑:
<androidx.drawerlayout.widget.DrawerLayout
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:id="@+id/navigation_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/navview"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" />
<com.google.android.material.navigation.NavigationView
android:id="@+id/nvView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
android:background="@color/navview"
app:itemBackground="@color/navview"
app:menu="@menu/toolbar_menu">
</com.google.android.material.navigation.NavigationView>
</androidx.drawerlayout.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
我的导航视图的背景颜色不正确,项目的背景颜色正确。我想要达到的颜色是#121212。
android kotlin android-navigationview material-components material-components-android