Android 单击时隐藏导航项

Android 单击时隐藏导航项,android,Android,这是我的导航抽屉的屏幕截图,下面是我正在使用的依赖项 compile 'com.jakewharton:butterknife:8.2.1' compile 'com.android.support:appcompat-v7:25.2.0' compile 'com.android.support:design:25.2.0' compile 'com.android.volley:volley:1.0.0' compile 'com.android.sup

这是我的导航抽屉的屏幕截图,下面是我正在使用的依赖项

   compile 'com.jakewharton:butterknife:8.2.1'
    compile 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:support-v4:25.2.0'
    compile 'com.android.support:recyclerview-v7:25.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:multidex:1.0.0'
    compile 'com.github.hotchemi:permissionsdispatcher:2.0.3'
    compile 'com.makeramen:roundedimageview:2.3.0'
    compile 'com.android.support:cardview-v7:25.2.0'

这些是我的依赖项

在导航抽屉的OnClick()中更改颜色。

这里有颜色问题,我只是在应用程序主题中使用了相同的颜色,我只是更改了颜色并添加了( app:itemIconTint=“@color/text\u color\u white” app:itemTextColor=“@color/text\u color\u white”) 此代码将转换为导航视图的xml

<android.support.v4.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/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        **app:itemIconTint="@color/text_color_white"
        app:itemTextColor="@color/text_color_white"**
        app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>


您的代码中似乎存在一些选择/颜色问题。请更改nevigationdrawer的项目选择颜色,如“app:itemBackground=“@color/drawer\u item”,并将其放在导航抽屉中。thanx各位,您的评论真的帮助了我