我用NavigationDrawer
和COMMUN材料設計menu.xml
這樣的設計佈局,但我不能找到一種方法,使不同顏色的菜單項的每一行。怎麼做?如何更改NavigationDrawer材質設計中每個菜單項的背景顏色?
這裏是我的抽屜式導航欄中的xml:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:id="@+id/drawer_layout"
xmlns:app="http://schemas.android.com/apk/res-auto" >
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:itemTextColor="#333"
app:itemIconTint="#333"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer" />
</android.support.v4.widget.DrawerLayout>
你可以只發布代碼,你試過了什麼? –
*請參閱http://www.tutecentral.com/android-custom-navigation-drawer/ – karthik
以及我已經嘗試programetically創建navigationmenu和並儘量選擇菜單項,但沒有發現設置背景顏色#菜單項的任何財產Nigam Patro –