I have a custom theme for my android app. I have to change the options menu color, now it is white dots. I have to change the color to red.
<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle" tools:targetApi="23">@style/ActionBarStyle</item>
<item name="android:actionBarTabTextStyle" tools:targetApi="23">@style/ActionBarTabText
</item>
<item name="colorControlNormal">@color/vkcred</item>
<!--<item name="drawerArrowStyle">@style/DrawerIcon</item>-->
<item name="android:popupBackground" tools:targetApi="23">@color/home_list_color</item>
<item name="android:actionMenuTextColor" tools:targetApi="23">@color/action_bar_title</item>
<item name="android:actionBarWidgetTheme">@style/PopupWrapper</item>
<item name="android:itemTextAppearance">@style/menuCustomMenuTextApearance</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">@style/ActionBarStyle</item>
<item name="actionBarTabTextStyle">@style/ActionBarTabText</item>
<item name="actionMenuTextColor">@color/action_bar_title</item>
<item name="android:actionOverflowButtonStyle">@style/Widget.ActionButton.Overflow</item>
</style>
<style name="Widget.ActionButton.Overflow" parent="@android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:contentDescription">@string/accessibility_overflow</item>
<item name="android:dropDownListViewStyle">@style/PopupMenuListView</item>
</style>
<style name="PopupWrapper" parent="@android:style/Theme.Holo">
<item name="android:popupMenuStyle">@style/PopupMenuStyle</item>
</style>
<!-- ActionBar styles -->
<style name="ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="android:titleTextStyle" tools:targetApi="23">@style/ActionBarTitleText</item>
<!-- <item name="android:background" tools:targetApi="11">@drawable/titlebar</item> -->
<item name="android:popupBackground" tools:targetApi="23">@color/home_list_color</item>
<!-- <item name="windowActionBar">false</item>-->
<!-- Support library compatibility -->
<item name="titleTextStyle">@style/ActionBarTitleText</item>
<!--<item name="background">@color/white</item>-->
</style>
<!-- ActionBar title text -->
<style name="ActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/action_bar_title</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
<!-- ActionBar tabs text -->
<style name="ActionBarTabText" parent="@style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">@color/action_bar_title</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
Actually I have to change the option menu color to red. As I am new to the theme change using styles, I was unable to find what the issue is. Hi I am not using a toolbar instead using getSupportActionBar().Please help me in resolving this
Inside style.xml change your colorPrimary and colorSecondary to red and slightly red ,
You can find the material pallets on https://www.materialpalette.com Download the style.xml and paste in your res folder.
Try this code in your CustomActionBarTheme
:
<!-- android:textColorSecondary is the color of the menu overflow icon (three vertical dots) -->
<item name="android:textColorSecondary">@color/red</item>
And change parent theme to :
<style name="CustomActionBarTheme" parent="Theme.AppCompat.Light">
Hope it helps!
<style name="MyToolbarTheme">
<!-- Used to tint the back arrow, menu and spinner arrow -->
<item name="colorControlNormal">#EF5350</item> //red
</style>
<Toolbar
android:theme="@style/MyToolbarTheme"
.../>
You can set theme programmatically like this
getSupportActionBar().getThemedContext().setTheme(R.style.MyToolbarTheme);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.