Android styles: how to change colors in styles.xml - android

I want to change some colors of android UI elements. But I would prefer to set a default tint color, which applies to all UI elements. I am not sure if this is possible.
If not, I want to set the "tint"-color of some UI elements, as shown below. Can anybody enlighten me?
EDIT
Based on what Entreco suggested:
My styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:textColorPrimary">#color/brown</item>
<item name="android:textColorSecondary">#color/brown</item>
<item name="android:textColorTertiary">#color/brown</item>
<item name="android:textColorPrimaryInverse">#color/brown</item>
<item name="android:textColorSecondaryInverse">#color/brown</item>
<item name="android:textColorTertiaryInverse">#color/brown</item>
<item name="colorPrimary">#color/blue</item>
<item name="colorPrimaryDark">#color/blue</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- style for the action bar backgrounds -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="android:subtitleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="android:background">#color/brown</item>
<item name="titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="subtitleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="background">#color/brown</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance">
<item name="android:textColor">#color/brown_light</item>
<item name="android:textSize">24sp</item>
</style>
</resources>
And my values-v21/styles.xml:
<resources>
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:colorPrimary">#color/blue</item>
<item name="android:colorPrimaryDark">#color/blue</item>
<!-- <item name="android:colorAccent">#color/white</item> -->
</style>
</resources>
And in my Manifest:
<application android:theme="#style/AppTheme.Base" >
...
</application>
But the primary color is still the same...???

Starting from Lollipop this is straight-forward thanks to the colorPrimary attribute:
file values/styles.xml:
<!-- Base application theme. -->
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primary_dark</item>
</style>
file values-v21/styles.xml:
<style name="AppTheme" parent="AppTheme.Base">
<item name="android:colorPrimary">#color/primary</item>
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<item name="android:colorAccent">#color/white</item>
</style>
Basically, you can define a color pallete for your app, and I believe for your case your want to set the colorPrimary (unverified).
More info on Material colors

Related

How to change ActionBar Colour

I am trying to change my App ActionBar colour to no success. I am using the this library https://github.com/neokree/MaterialNavigationDrawer;
Here is the style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:actionBarStyle">#style/AppTheme.ActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/AppTheme.ActionBar</item>
<item name="colorControlActivated">#color/color_c</item>
<item name="toolbarStyle">#style/Widget.Toolbar</item>
</style>
<style name="Widget.Toolbar" parent="#style/Widget.AppCompat.Toolbar">
<item name="contentInsetStart">5dp</item>
</style>
<style name="AppTheme.ActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/color_a</item>
<item name="background">#color/color_a</item>
<!-- Support library compatibility -->
</style>
<style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowBackground">#null</item>
</style>
<style name="MyNavigationDrawerTheme" parent="MaterialNavigationDrawerTheme.Light.DarkActionBar">
<item name="colorPrimary">#color/color_a</item>
<item name="colorPrimaryDark">#color/color_a</item>
<item name="colorAccent">#FFFFFF</item>
<item name="rippleBackport">true</item>
<item name="singleAccount">true</item>
<item name="multipaneSupport">true</item>
<!--<item name="learningPattern">false</item>-->
</style>
<style name="MySubheaderTheme">
<item name="subheaderTitleColor">#000000</item>
</style>
<style name="MySectionTheme" >
<item name="sectionColorIcon">#000000</item>
<item name="sectionColorText">#000000</item>
<item name="sectionColorNotification">#000000</item>
<item name="sectionBackgroundColorPressed">#160000FF</item>
<item name="sectionBackgroundColorSelected">#0A0000FF</item>
<item name="sectionBackgroundColor">#000000FF</item>
</style>
</resources>
I use the MyNavigationDrawerTheme theme for my activities.
You should be able to set the action bar color using the android:colorPrimary attribute:
<resources>
<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">#color/accent</item>
</style>
</resources>
Based on information here
You should create your styles also for v21 and above with a small change (because they natively support material theme).
And in values-v21/style.xml add android:colorPrimary and others attributes with android: prefix to your style:
<style name="MyNavigationDrawerTheme" parent="MaterialNavigationDrawerTheme.Light.DarkActionBar">
<item name="android:colorPrimary">#color/color_a</item>
<item name="android:colorPrimaryDark">#color/color_a</item>
<item name="android:colorAccent">#FFFFFF</item>
<!--...-->
</style>

Backward compatibity using v-21/styles.xml not working

I am trying to style my button while maintaining backwards compatibility.
I have 2 files as follows:
values/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">#color/accent</item>
<item name="android:textColorPrimary">#color/primary_text</item>
<item name="android:textColorSecondary">#color/secondary_text</item>
<item name="android:buttonStyle">#style/RoundedButton</item>
</style>
<style name="RoundedButton" parent="#style/Widget.AppCompat.Button">
</style>
<style name="AppName.NoActionBar" parent="AppTheme" >
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="DemoButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minWidth">40dp</item>
</style>
</resources>
values-v21/styles.xml:
<resources>
<style name="RoundedButton" parent="Widget.AppCompat.Button">
<item name="android:background">#drawable/btn_rounded</item>
</style>
</resources>
But even then my button looses all attributes i.e. just a text is displayed as per android-studio's "XML preview". I just want the button to default to the usual Holo theme on pre-lolipop devices. It works as expected on Lolipop devices.
What am I doing wrong?
In values/styles.xml
<style name="RoundedButton" parent="#style/Widget.AppCompat.Button">
</style>
change it to as Follow :-
<style name="RoundedButton" parent="android:Widget.Holo">
</style>
I couldn't figure out the reason of why this was happening so I removed the line <item name="android:buttonStyle">#style/RoundedButton</item> from my values/styles.xml file, and added it to my values-v21/styles.xml.
I do not like this solution as there is a lot of code duplication. The only good thing about it is that it works.
Now my files look like:
values/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">#color/accent</item>
<item name="android:textColorPrimary">#color/primary_text</item>
<item name="android:textColorSecondary">#color/secondary_text</item>
</style>
<style name="AppName.NoActionBar" parent="AppTheme" >
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="DemoButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minWidth">40dp</item>
</style>
</resources>
v21/styles.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="colorAccent">#color/accent</item>
<item name="android:textColorPrimary">#color/primary_text</item>
<item name="android:textColorSecondary">#color/secondary_text</item>
<item name="android:buttonStyle">#style/RoundedButton</item>
</style>
<style name="RoundedButton" parent="Widget.AppCompat.Button">
<item name="android:background">#drawable/btn_rounded</item>
</style>
<style name="AppName.NoActionBar" parent="AppTheme" >
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="DemoButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:minWidth">40dp</item>
</style>
</resources>

Android Status Bar Prevent Coloring

I am having a problem preventing the status bar from taking on the primaryColor. I want to leave the status bar unstyled but on lollipop it is always taking on the color of the primaryColor defined in my styles.xml
Excerpt from styles:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" >
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme.TransparentActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
<item name="android:windowBackground">#color/white</item>
</style>
<!-- START Market Themes -->
<style name="AppTheme.Blue" parent="AppTheme">
<item name="colorPrimary">#color/primaryColorBlue</item>
</style>
styles/v21
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar" >
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
</style>
<!-- Base application theme. -->
<style name="AppTheme.TransparentActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimaryDark">?attr/colorPrimary</item>
<item name="colorAccent">?attr/colorPrimary</item>
<item name="android:textColorPrimary">#android:color/primary_text_light</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">#color/black</item>
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
<item name="android:windowBackground">#color/white</item>
<item name="android:windowContentTransitions">true</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#android:color/white</item>
</style>
<style name="ToolBarStyle" parent="">
<item name="android:elevation">#dimen/toolbar_elevation</item>
<item name="popupTheme">#style/ThemeOverlay.AppCompat.Light</item>
<item name="theme">#style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
You're telling it to be your primary colour.
The status bar gets its colour form your colorPrimaryDark so change
<item name="colorPrimaryDark">?attr/colorPrimary</item>
to
<item name="colorPrimary">?attr/colorPrimary</item>
<item name="colorPrimaryDark">#android:color/black</item>
I think this should only be necessary in your styles-v21 but I'm not close enough to anything to test it.
Docs here
<resources>
<!-- inherit from the material theme -->
<style name="AppTheme" parent="android:Theme.Material">
<!-- Main theme colors -->
<!-- your app branding color for the app bar -->
<item name="android:colorPrimary">#color/primary</item>
<!-- darker variant for the status bar and contextual app bars -->
<item name="android:colorPrimaryDark">#color/primary_dark</item>
<!-- theme UI controls like checkboxes and text fields -->
<item name="android:colorAccent">#color/accent</item>
</style>
</resources>

Change the title text color in the Android ActionBar via xml

I want to change the title text color of the ActionBar in my app. I have tried in many ways but I can't achieve it. I don't want to do it programatically because when the app is launched it shows the action bar with previous color and then changes to the new one. I'm supporting from Api Level 8 and my xml was generated with the Android Action Bar Style Generator. Then I tried to change the title text color with this . The title text color is still black.
This is my code:
<resources>
<style name="Theme.Dbtools_style" parent="#style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">#drawable/selectable_background_dbtools_style</item>
<item name="popupMenuStyle">#style/PopupMenu.Dbtools_style</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Dbtools_style</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Dbtools_style</item>
<item name="actionDropDownStyle">#style/DropDownNav.Dbtools_style</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Dbtools_style</item>
<item name="actionModeBackground">#drawable/cab_background_top_dbtools_style</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_dbtools_style</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Dbtools_style</item>
<!-- Remove icon in Action Bar -->
<item name="android:displayOptions">showHome|homeAsUp|showTitle</item>
<item name="displayOptions">showHome|homeAsUp|showTitle</item>
<item name="android:icon">#android:color/transparent</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/ActionBar.Solid.Dbtools_style</item>
</style>
<style name="ActionBar.Solid.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_dbtools_style</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_dbtools_style</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_dbtools_style</item>
<item name="progressBarStyle">#style/ProgressBar.Dbtools_style</item>
<!-- Title Text Color -->
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="ActionBar.Transparent.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/ab_transparent_dbtools_style</item>
<item name="progressBarStyle">#style/ProgressBar.Dbtools_style</item>
</style>
<style name="PopupMenu.Dbtools_style" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_dbtools_style</item>
</style>
<style name="DropDownListView.Dbtools_style" parent="#style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_dbtools_style</item>
</style>
<style name="ActionBarTabStyle.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_dbtools_style</item>
</style>
<style name="DropDownNav.Dbtools_style" parent="#style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_dbtools_style</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_dbtools_style</item>
<item name="android:dropDownSelector">#drawable/selectable_background_dbtools_style</item>
</style>
<style name="ProgressBar.Dbtools_style" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_dbtools_style</item>
</style>
<style name="ActionButton.CloseMode.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_dbtools_style</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Dbtools_style.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Dbtools_style</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Dbtools_style</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
I solved my problem. The problem was that I was testing in a device with api level 14+ and I just added the style to res/values . I had to add the style in res/values-v14 too. I attach my code:
res/values/styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Dbtools_style" parent="#style/Theme.AppCompat.Light">
<!-- Title Text Color -->
<item name="actionMenuTextColor">#color/white</item>
</style>
<style name="ActionBar.Solid.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<!-- Title Text Color -->
<item name="titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
res/values-v14/styles.xml
<style name="Theme.Dbtools_style" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/ActionBar.Solid.Dbtools_style</item>
<!-- Title Text Color -->
<item name="android:actionMenuTextColor">#color/white</item>
</style>
<style name="ActionBar.Solid.Dbtools_style" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<!-- Title Text color -->
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
You Have to do two things:
Styles.xml
<style name="MyTheme" parent="#android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#FF9D21</item>
<item name="android:titleTextStyle">#style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/red</item>
</style>
Colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#FF0000</color>
</resources>
This link might help you out with the appropriate color you want.
This link is also helpful.
Set titletextstyle and subtitletextstyle too ...
This is what worked for me. ..
If you want to change that using xml ...
This is what worked for me ...
<style name="MyActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/titleBarBgColor</item>
<item name="android:titleTextStyle">#style/EldTheme.ActionBar.TitleTextStyle</item>
<item name="android:subtitleTextStyle">#style/EldTheme.ActionBar.TitleTextStyle</item>
<!-- Support library compatibility -->
<item name="background">#color/titleBarBgColor</item>
<item name="titleTextStyle">#style/EldTheme.ActionBar.TitleTextStyle</item>
<item name="subtitleTextStyle">#style/EldTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="EldTheme.ActionBar.TitleTextStyle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/titleBarTextColor</item>
</style>
for me this one worked.
go to /value/colors.xml
add <color name="black">#000000</color> //if you want black to your <resources>
to to /values/styles.xml
add <item name="titleTextColor">#color/black</item> to your <style>
here is some example code, too:
color.xml:
<resources>
<color name="colorPrimary">#ffffff</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#03DAC5</color>
<color name="black">#000000</color>
</resources>
styles.xml:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="titleTextColor">#color/black</item>
</style>```

Change ActionBar OverflowMenu Background color

Ive added a lot of properties to change to background color of the overflow menu, none seem to work.
Here are a few links i've refered (other than SO questions):
http://blog.stylingandroid.com/archives/1267
http://android-developers.blogspot.in/2011/04/customizing-action-bar.html
res>values>
style.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="android:Theme.Light"></style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:dropDownListViewStyle">#style/MyDropDownListView</item>
<item name="android:actionDropDownStyle">#style/MyDropDownNav</item>
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
</style>
<style name="MyPopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#28bda9</item>
<item name="android:titleTextStyle">#style/Theme.MyAppTheme.ActionBar.TitleTextStyle</item>
</style>
<style name="Theme.MyAppTheme.ActionBar.TitleTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#28bda9</item>
</style>
<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#28bda9</item>
</style>
<!-- style the list navigation -->
<style name="MyDropDownNav" parent="android:style/Widget.Holo.Light.Spinner">
<item name="android:background">#28bda9</item>
<item name="android:popupBackground">#28bda9</item>
<item name="android:dropDownSelector">#28bda9</item>
</style>
</resources>
Edit: I have changed the code to match the solution. This was the error:
<style name="MyPopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">**#28bda9**</item>
</style>
You're on the right track, but the popupBackground is not merely a color.
You have to change the drawable.
Below is the default drawable for Holo Light (usually called menu_dropdown_panel).
Change the color using your favorite image editor, and put it your drawable-x folder.
The needed style will be as follows:
<style name="AppTheme" parent="AppBaseTheme">
...
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
</style>
<style name="MyPopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel</item>
</style>

Categories

Resources