Android - Change tint background color to navigation drawer?

廉价感情. 提交于 2019-12-06 02:04:53

问题


I'm working with Navigation Drawer and i need to change the color of tint background from black to green. any ideas?


回答1:


Try This :

yourDrawerLayout.setScrimColor(Color.GREEN);



回答2:


You need update latest support library.

latest version- 25.4.0

Add this repository in,

allprojects {
  repositories {
    maven {
        url "https://maven.google.com"
    }
  }
}

Project level build.gradle

Update your xml

<android.support.design.widget.NavigationView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@android:color/white"//Change background color
        android:fitsSystemWindows="false"
        app:headerLayout="@layout/drawer_header"//Set your header
        app:itemIconTint="@color/colorPrimary"//Change Text color
        app:menu="@menu/drawer" />// set your menu items.


来源:https://stackoverflow.com/questions/45269338/android-change-tint-background-color-to-navigation-drawer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!