How do I change the Action Bar Overflow button color

前端 未结 4 734
没有蜡笔的小新
没有蜡笔的小新 2020-12-16 15:12

First off I have read Change color of the overflow button on action bar but I\'m not able to get it to work.

I just want to have a simple theme: Action bar backgro

相关标签:
4条回答
  • 2020-12-16 15:14

    Add actionOverflowButtonStyle in your main theme.

    <style name="AppTheme" parent="Theme.AppCompat.Light">
     <item name="actionBarStyle">@style/ActionBarStyle</item>
     <item name="actionOverflowButtonStyle">@style/AppTheme.ActionButton.Overflow</item>
    </style>
    

    It's Done.

    0 讨论(0)
  • 2020-12-16 15:23

    There is a way that can solve it easier, for example if we want white color of title letter and icons of a toolbar, we can do this:

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="@color/colorPrimary"
        android:theme="@style/MainMenu"
        app:popupTheme="@style/android:Theme.Holo.Light"/>
    

    and in styles.xml file we can do this:

    <style name="MainMenu" parent="Theme.AppCompat.NoActionBar">
        <item name="android:textColorSecondary">@color/white</item>
    </style>
    

    this android:textColorSecondary changes the color of icons in toolbar.

    0 讨论(0)
  • 2020-12-16 15:24

    I found another way to do it which does not require replacing the image!

    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="actionBarTheme">@style/AppTheme.ActionBarTheme</item> <!-- used for the back arrow on the action bar -->
    </style>
    
    <style name="AppTheme.ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
        <!-- THIS is where you can color the arrow and the overflow button! -->
        <item name="colorControlNormal">@color/splash_title</item> <!-- sets the color for the back arrow -->
        <item name="actionOverflowButtonStyle">@style/actionOverflowButtonStyle</item> <!-- sets the style for the overflow button -->
    </style>
    
    <!-- This style is where you define the tint color of your overflow menu button -->
    <style name="actionOverflowButtonStyle" parent="@style/Widget.AppCompat.ActionButton.Overflow">
        <item name="android:tint">@color/white</item>
    </style>
    
    0 讨论(0)
  • 2020-12-16 15:24

    android:textColorSecondary did not work for me. So I tried tinting the overflow style:

    <style name="DotsDarkTheme" parent="@style/Widget.AppCompat.ActionButton.Overflow" >
        <item name="android:tint">@color/yourLightColor</item>
    </style>
    

    and then use it in your style:

      <style name="YourDarkAppTheme">
    
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    
        ... your appTheme
    
    
        <item name="actionOverflowButtonStyle">@style/DotsDarkTheme</item>
    
    
      </style>
    

    (I already answered in this thread: Change the action bar settings icon color But this was my first hit on Google when searching for an answer)

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