简体   繁体   English

Android - 将色调背景颜色更改为导航抽屉?

[英]Android - Change tint background color to navigation drawer?

I'm working with Navigation Drawer and i need to change the color of tint background from black to green. 我正在使用导航抽屉,我需要将色调背景的颜色从黑色更改为绿色。 any ideas? 有任何想法吗?

在此输入图像描述

You need update latest support library. 您需要更新最新的支持库。

latest version- 25.4.0 最新版本 - 25.4.0

Add this repository in, 添加此存储库,

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

Project level build.gradle 项目级build.gradle

Update your xml 更新你的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.

尝试这个 :

yourDrawerLayout.setScrimColor(Color.GREEN);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM