Android Studio Navigation Draw Activity

后端 未结 2 1863
不知归路
不知归路 2021-01-26 06:43

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 t

相关标签:
2条回答
  • 2021-01-26 06:57

    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.

    0 讨论(0)
  • 2021-01-26 07:06

    I just made some changes.

    To define the color there are two ways to use the colors file in the values ​​directory or define in hexadecimal as for example android: background = "# 84FFFF".

    <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"/>
    

    0 讨论(0)
提交回复
热议问题