【发布时间】:2020-03-20 09:25:30
【问题描述】:
我希望我的导航视图的背景为 #121212,但它变成了浅灰色。但是,当应用与背景相同的颜色时,视图中的项目会显示正确的颜色。
android:background="@color/navview"
app:itemBackground="@color/navview"
测试项目的背景设置为与导航视图背景相同的颜色,但颜色存在惊人差异,如下所示。
导航视图背景是否有过滤器?我尝试通过将背景色调模式设置为 null 来禁用它,
nvView.backgroundTintMode = null
但它似乎没有任何效果。任何帮助表示赞赏!
编辑:
<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>
我的导航视图的背景颜色不正确,项目的背景颜色正确。我想要达到的颜色是#121212。
【问题讨论】:
标签: android kotlin material-components material-components-android android-navigationview