Android Studio Navigation Draw Activity

匿名 (未验证) 提交于 2019-12-03 02:43:01

问题:

I am creating an App with a Navigation Draw Activity. In android studio, after I start a new android activity project, I select Navigation draw activity. My question is, how to a change the background color of the navigation draw activity? Right now, the top part is green but the white part where the text and icons are is white and I want to change this white part to dark grey with white text.

Thanks. Rob

回答1:

Go to res -> layout -> activity_main.xml and add the following:

   <android.support.design.widget.NavigationView         app:itemTextColor="#A9A9A9"     // text color         android:background="#FF0000" /> // background color 

The top part it is defined in res -> layout -> nav_header_main.xml and the same color definitions apply to it too. Look for :

<LinearLayout android:background="@drawable/side_nav_bar" /> 

and change it to any color you want.



回答2:

I just made some changes.

<android.support.design.widget.NavigationView     android:id="@+id/ejemplo_nav_view"     android:layout_height="match_parent"     android:layout_width="wrap_content"     android:layout_gravity="start"     android:fitsSystemWindows="true"     app:headerLayout="@layout/ejemplo_nav_header"     app:menu="@menu/ejemplo_drawer_view"     android:background="@color/color_define"/> 



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!