Reputation: 11999
I want to change the text color and the navigation icon color in the toolbar
Change the text color of the action item "13311"
And also of the drawer icon.
The styles //activity theme
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/ColorPrimary</item>
<item name="colorPrimaryDark">@color/ColorPrimaryDark</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="switchStyle">@style/Switch</item>
</style>
//theme for switch widget
<style name="Switch" parent="Widget.AppCompat.CompoundButton.Switch">
<item name="android:thumb">@drawable/switch_selector</item>
<item name="showText">false</item>
</style>
//toolbar theme
<style name="MyDarkToolbarStyle" parent="Widget.AppCompat.Toolbar">
<item name="android:gravity">center_vertical</item>
<!--<item name="popupTheme">@style/PopupMenuStyle</item>-->
<item name="actionButtonStyle">@style/MyActionButtonStyle</item>
</style>
//overflow menu theme
<style name="PopupMenuStyle" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">@color/black</item>
<item name="android:gravity">left|center</item>
<item name="android:background">@color/white</item>
</style>
//action button theme
<style name="MyActionButtonStyle" parent="AppBaseTheme">
<item name="android:minWidth">0dip</item>
<item name="android:textSize">14sp</item>
<item name="android:paddingLeft">0dip</item>
<item name="android:paddingRight">0dip</item>
<item name="android:actionMenuTextColor">@color/white</item>
</style>
Upvotes: 2
Views: 4636
Reputation: 2124
<style name="MyDarkToolbarStyle" parent="ThemeOverlay.AppCompat.ActionBar">
<!-- text color for action menu icons -->
<item name="android:textColorSecondary">#fff</item>
<!-- overflow menu icon color -->
<item name="actionMenuTextColor">#fff</item>
</style>
Edit To change the navigation drawer color use
<style name="DrawerStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/drawer_color</item>
</style>
Upvotes: 4
Reputation: 979
To change arrow color I used colorControlNormal from AppTheme and AppTheme.ActionBarTheme
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light">
</style>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="android:windowTranslucentStatus" tools:targetApi="21">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="windowActionBar">false</item>
<!-- Toolbar Theme / Apply white arrow -->
<item name="colorControlNormal">@android:color/white</item>
<item name="actionBarTheme">@style/AppTheme.ActionBarTheme</item>
<item name="android:itemTextAppearance">@style/ToolbarTextAppearance</item>
<!-- Material Theme -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/accent_color</item>
<item name="android:statusBarColor" tools:targetApi="21">@color/statusBarColor</item>
<item name="android:navigationBarColor" tools:targetApi="21">@color/navigationBarColor</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="21">true</item>
</style>
<style name="AppTheme.ActionBarTheme" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<!-- White arrow -->
<item name="colorControlNormal">@android:color/white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@color/drawerArrowColor</item>
</style>
<style name="ToolbarTextAppearance">
<item name="android:textColor">@android:color/white</item>
</style>
Upvotes: 0
Reputation: 1248
change the parent theme to darkactionbar when the action bar is dark you will get your icon and text white , when it is light you will get them black . that's all
<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
Upvotes: 1