I've been searching around trying to fix this problem but I can't seem to find the answer. I have multiple items in this navigation drawer and each one of those items holds a menu of other items. The parent items have a title associated with them and I want to change the text color but I can't seem to find the answer anywhere. I would really appreciate the help, and here is an image to more accurately understand my issue.
Navigation Drawer: Android Studio
Thank you for the help in advance!
<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"
android:fitsSystemWindows="true"
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"
android:fitsSystemWindows="true"
android:background="@color/colorPrimaryDark"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer"
app:itemTextColor="@color/white"
app:itemIconTint="@color/white" />
</android.support.v4.widget.DrawerLayout>
If you are using NavigationView
introduced in material design library then add following attribute to change the color of your drawer item
<android.support.design.widget.NavigationView
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:itemBackground="@drawable/my_ripple" //sets background of the item
app:itemIconTint="@color/item_icon_color" //sets color of the drawer item icon
app:itemTextColor="@color/item_color" //sets color of the drawer item
....
/>
you put navigationview like that.
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@color/colorContentBG">
<include layout="@layout/nav_header_main" />
<ListView
android:entries="@array/test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listMenu"
android:dividerHeight="0dp"
android:divider="@android:color/transparent"/>
</LinearLayout>
</android.support.design.widget.NavigationView>
and whatever ui design for listview.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.