Android - Change tint background color to navigati

2019-04-11 11:12发布

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

enter image description here

2条回答
贪生不怕死
2楼-- · 2019-04-11 11:35

Try This :

yourDrawerLayout.setScrimColor(Color.GREEN);
查看更多
家丑人穷心不美
3楼-- · 2019-04-11 11:48

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.
查看更多
登录 后发表回答