I have a OncreateOptionsMenu where I can change test color and background but not able to change top and bottom grey color into blue color in the below image. Any suggestions and solutions are welocme.
Image:
Theme:
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/background</item>
<item name="colorPrimaryVariant">@color/background</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/background</item>
<item name="colorSecondaryVariant">@color/background</item>
<item name="colorOnSecondary">@color/background</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Dropdown Top and Bottom Color. -->
<item name="colorSurface">@color/background</item>
<!-- OncreateOptionsMenu Style -->
<item name="android:itemTextAppearance">@style/OptionsMenuStyle</item>
<item name="android:itemBackground">@color/background</item>
</style>
<!-- OncreateOptionsMenu Style -->
<style name="OptionsMenuStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
<item name="android:textStyle">italic</item>
</style>
CodePudding user response:
Try this!
Following is the styles.xml file.
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- This is the styling for action bar -->
<item name="actionBarStyle">@style/MyActionBar</item>
<!--To change the text styling of options menu items</item>-->
<item name="android:itemTextAppearance">@style/MyActionBar.MenuTextStyle</item>
<!--To change the background of options menu-->
<item name="android:itemBackground">@color/skyBlue</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">@color/red</item>
<item name="titleTextStyle">@style/MyActionBarTitle</item>
</style>
<style name="MyActionBarTitle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
</style>
<style name="MyActionBar.MenuTextStyle"
parent="style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/red</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">25sp</item>
</style>
</resources>