How to change the navigation icon color

前端 未结 2 1398
孤城傲影
孤城傲影 2020-12-12 04:28

I have a navigationView in my app and after add two lines in app style :

false


        
相关标签:
2条回答
  • 2020-12-12 05:11

    If you are looking to change text colors/appearance in the NavigationView Items, you should use the attribs

    • app:itemTextColor
    • app:itemIconTint
    • app:itemTextAppearance

    Otherwise, Specify which view's color you want to change. Setting android:textColorSeconday is a bad idea according to me.

    0 讨论(0)
  • 2020-12-12 05:16

    Using a Toolbar, to change the navigation icon color you can use:

    With a MaterialToolbar or (androidx and a Material theme):

    <com.google.android.material.appbar.MaterialToolbar
        android:theme="@style/MyThemeOverlay_Toolbar"
        ...>
    
      <style name="MyThemeOverlay_Toolbar" parent="ThemeOverlay.MaterialComponents.Toolbar.Primary">
        <!-- color used by navigation icon and overflow icon -->
        <item name="colorOnPrimary">@color/secondaryColor</item>
      </style>
    

    With the support Library:

    <android.support.v7.widget.Toolbar
      app:theme="@style/ThemeToolbar" />
    
    
    <style name="ThemeToolbar" parent="Theme.AppCompat.Light">
       <!-- navigation icon color -->
       <item name="colorControlNormal">@color/my_color</item>
    </style>
    
    0 讨论(0)
提交回复
热议问题