I have given a custom theme, different style.xml for API levels "7-13" and "14 and above"
<style name="CustomTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="actionBarStyle">#style/CustomTheme</item>
</style>
<style name="CustomTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="background">#color/medium_turquoise</item>
</style>
<style name="CustomTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarSize">200dp</item>
</style>
<style name="CustomTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="homeAsUpIndicator">#drawable/back_button_actionbar</item>
I have set the theme of my application as "#style/CustomTheme" and in my activity i have set following.
addView = getLayoutInflater().inflate(R.layout.actionbar, null);
getSupportActionBar().setCustomView(addView);
getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
The entire screen has been taken by the action bar, I tried to change the height but of no use. I guess I am doing some mistake with the style.
Thanks
Your code seems to be perfectly fine to me. Maybe Genymotion is not rendering it properly. Try running it on actual device or emulator in sdk.
Also one suggestion, if you are making a custom theme in android then try to avoid defining same style attribute again. see below
<style name="CustomTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<!-- Setting values in the default namespace affects API levels 7-13 -->
<item name="actionBarStyle">#style/CustomTheme</item>
<item name="background">#color/medium_turquoise</item>
<item name="actionBarSize">200dp</item>
<item name="homeAsUpIndicator">#drawable/back_button_actionbar</item>
</style>
Related
I am trying to add two CheckBox views to a feedback Fragment in my current app, which is using the AppCompat library (v7:22.2.1) . The API range for this app is 16-current (22). My manifest is set up with the following theme definition:
android:theme="#style/AppTheme"
which is defined as such in my styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.FacebookFlatButton">
<item name="android:background">#drawable/facebook_flat_button</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">#android:color/white</item>
</style>
<style name="AppTheme.TwitterFlatButton">
<item name="android:background">#drawable/twitter_flat_button</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">#android:color/white</item>
</style>
</resources>
The problem is my CheckBox (and I also notice my EditText) views don't default to a proper color such that they are viewable when checked. Here is a screenshot of the Preview in Android Studio and my emulator side-by-side:
No matter what combination of style items I put in this style from other SO articles such as this one, the colors don't change in the emulator or on a device, but they are updating in the Preview. I have also tried various tweaks of the parent theme to my custom theme, but nothing seems to matter.
I have tried this in a Nexus 5 (API 19) and a Nexus 6 (API 22) emulator, and it also does the same thing on my Nexus 6 device.
I'm not defining much at all custom here, but I still feel like I'm missing some small critical piece of information here. What am I missing?
OK, after much research and testing, I have a solution that works both for my CheckBox and EditText controls.
The (bad) assumption on my part was that one theme could take care of AppCompat and Material Design, which is not true. Basically, for AppCompat (< API 21), you have to define your styles with names without the android: prefix, such as this for the CheckBox and EditText:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.EditText" parent="Widget.AppCompat.EditText">
<item name="colorControlNormal">#color/almanac_red_dark</item>
<item name="colorControlActivated">#color/almanac_red_light</item>
<item name="colorControlHighlight">#color/almanac_red_light</item>
</style>
<style name="AppTheme.CheckBox">
<item name="colorAccent">#color/almanac_red_dark</item>
</style>
<style name="AppTheme.FlatButton">
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
<item name="android:textColor">#android:color/white</item>
</style>
<style name="AppTheme.FacebookFlatButton" parent="AppTheme.FlatButton">
<item name="android:background">#drawable/facebook_flat_button</item>
</style>
<style name="AppTheme.TwitterFlatButton" parent="AppTheme.FlatButton">
<item name="android:background">#drawable/twitter_flat_button</item>
</style>
</resources>
But you have to have another version of the style for Material Design versions (> API 21) in the values-v21 directory (with the Material Design parent theme), with the android: prefix:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="#android:style/Theme.Material.Light">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.EditText">
<item name="android:colorControlNormal">#color/almanac_red_dark</item>
<item name="android:colorControlActivated">#color/almanac_red_light</item>
<item name="android:colorControlHighlight">#color/almanac_red_light</item>
</style>
<style name="AppTheme.CheckBox">
<item name="android:colorAccent">#color/almanac_red_dark</item>
</style>
</resources>
I have tried on the Nexus 4 (API 16), Nexus 5 (API 19) and Nexus 6 (API 22) emulators and my physical Nexus 6 device and everything looks as I expect.
You need to specify the acent colors for that, put below line in your main style 'AppTheme'
<item name="colorAccent">#color/color_primary</item>
This will change your checkbox and edittext color
I have been trying to change the background colour of my ActionBar in my app. But it seems to give me some error.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/actionbar_background</item>
<!-- Support library compatibility -->
<item name="background">#drawable/actionbar_background</item>
</style>
The error I get is on the
<item name="background">#drawable/actionbar_background</item>
I just want to change the background of the actionBar to a different colour.
Help will be appreciated. Thanks
If you target for minimum API level 11 , you can change ActionBar's background color by defining custom style, as:
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">ANY_HEX_COLOR_CODE</item>
</style>
</resources>
And, set "MyTheme" as theme for application / activity.
You can also use this online tool to generate a full customized ActionBar
Here is tool
It's also possible to change the color of the ActionBar programmatically, just call this line:
getActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.my_color)));
That's also possible via getSupportActionBar() (if you're using ActionBarSherlock).
I am trying to give transparent effect to my action bar. I have used the following line to make it work that way, but strangely on my Nexus 5 I am can see the bar coming, but on my galaxy nexus I don't see it at all.
I am not sure why this is coming up on N5? How to solve this issue?
Here is the code:
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(false);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
actionBar.setStackedBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
setContentView(R.layout.profile);
Here is the screenshot for both Galaxy nexus running Jelly Bean (4.3) and Nexus 5 running kitkat (4.4.4)
Galaxy Nexus: showing transparent action bar perfectly:
Nexus 5: showing transparent action bar: (A horizontal line is shown)
Update 2:
I managed to remove the line on N5 by using the following style
styles.xml in Values-v14 folder
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"></style>
<style name="CustomActionBarTheme" parent="#android:style/Theme.Holo"></style>
then added theme to specific activity in manifext:
<activity
android:name=".Profile"
android:label="#string/profile"
android:theme="#style/CustomActionBarTheme"
android:screenOrientation="portrait" >
but then all my text, dialog format have changed in this activity. It has become dark. It doesn't change even though I programatically change the theme for dialog. I am not sure what is wrong? Can someone help me out with this?
Update 1: As per #erakitn advice: I tried the following with few changes:
<!-- Transparent ActionBar Style -->
<style name="CustomThemeTransparent" parent="AppBaseTheme">
<item name="android:background">#android:color/transparent</item>
<item name="background">#android:color/transparent</item>
</style>
<!-- Activity Theme with transparent ActionBar -->
<style name="CustomThemeTransparentLight" parent="AppBaseTheme">
<item name="android:actionBarStyle">#style/CustomThemeTransparent</item>
<item name="actionBarStyle">#style/CustomThemeTransparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
I have getting the following error:
1. error: Error: No resource found that matches the given name: attr 'background'.
2. error: Error: No resource found that matches the given name: attr 'actionBarStyle'.
3. error: Error: No resource found that matches the given name: attr 'windowActionBarOverlay'.
To remove ActionBar shadow try to add <item name="android:windowContentOverlay">#null</item> attribute to your Activity theme. Below there is an example of theme with transparent ActionBar. Define it in res/styles.xml:
<!-- Your App Theme-->
<style name="YourAppTheme.Light" parent="#style/Theme.AppCompat.Light">
<...>
</style>
<!-- Transparent ActionBar Style -->
<style name="YourAppTheme.Light.ActionBar.Transparent" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:background">#android:color/transparent</item>
<item name="background">#android:color/transparent</item>
</style>
<!-- Activity Theme with transparent ActionBar -->
<style name="YourAppTheme.TransparentActionBar.Light" parent="#style/YourAppTheme.Light">
<item name="android:actionBarStyle">#style/YourAppTheme.Light.ActionBar.Transparent</item>
<item name="actionBarStyle">#style/YourAppTheme.Light.ActionBar.Transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="windowActionBarOverlay">true</item>
</style>
And set this theme to your Activity:
<activity
android:name="your.package.name.YourActivity"
android:label="#string/app_name"
android:theme="#style/YourAppTheme.TransparentActionBar.Light" />
UPD:
If you are not using AppCompat or ABS you should use HOLO theme as parent for your theme. It seems you use light theme with dark ActionBar. Please try following solution:
<!-- Your App Theme-->
<style name="YourAppTheme.Light" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<...>
</style>
<!-- Transparent ActionBar Style -->
<style name="YourAppTheme.Light.ActionBar.Transparent" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#android:color/transparent</item>
</style>
<!-- Activity Theme with transparent ActionBar -->
<style name="YourAppTheme.TransparentActionBar.Light" parent="#style/YourAppTheme.Light">
<item name="android:actionBarStyle">#style/YourAppTheme.Light.ActionBar.Transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
Please don't change anything
Your original code is just fine. All you need to do is set/apply the following attribute:
android:windowContentOverlay = true
Again, don't change your theme/style. Define a new one like this:
<style name="ConOver" > <<== no parent
<item name="android:windowContentOverlay">#null</item>
</style>
Add this above your code:
// Add this line
// Lets you add new attribute values into the current theme
getTheme().applyStyle(R.style.ConOver, true);
// Rest stays the same
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(false);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new
ColorDrawable(android.graphics.Color.TRANSPARENT));
actionBar.setStackedBackgroundDrawable(new
ColorDrawable(android.graphics.Color.TRANSPARENT));
setContentView(R.layout.profile);
Since you are using DarkActionBar as a theme now the dialog will turn black all around because that is the style DarkActionBar is using.
You can style your dialog from default light theme of HOLO for dialogs.
sample:
final AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, android.R.style.Theme_Holo_Light_Dialog));
EDIT:
Change this:
<style name="CustomActionBarTheme" parent="#android:style/Theme.Holo"></style>
To
<style name="CustomActionBarTheme" parent="#android:style/Theme.Holo.Light"></style>
I'm using the Android appcompat library to create a custom action bar. That all works. On devices not using the v11 theme (values folder) a bottom border does not appear as it should not. But when v11+ devices use the theme (in the values-v11 folder of course) there is a bottom border. It's a thin 1dp type border. I have a custom background applied for the actionbar and this all works on version < v11, just an annoying extra bottom border is added on v11+ devices ;-]
Now I found via another SO article where the user was using ActionBarSherlock that the base theme needed to be Theme.X and not theme.X.Light.x to resolve this issue (with no explanation as to why). I applied this same logic (I'm using android's appcompat, not sherlock one) and it worked for removing the border but then other style issues came up with radio buttons, etc, taking on the non-light theme. So I want to keep the base theme as 'Theme.AppCompat.Light' and get rid of the bottom border on the actionbar. Again, it doesn't show up on devices < v11.
Screen shots (Theme.AppCompat.Light/Theme.AppCompat):
My theme (same in values folder minus the android prefacing):
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Application theme. -->
<style name="ActionTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/ActionBarStyle</item>
<item name="android:windowActionBar">true</item>
</style>
<style name="ActionBarStyle" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:displayOptions"></item>
<item name="android:background">#drawable/header_style</item>
<item name="android:titleTextStyle">#style/ActionBarTitleText</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:height">70dp</item>
</style>
<style name="ActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/color_dark_blue</item>
</style>
</resources>
Through the power of SO my question was finally answered! I tried everything the OP in the below link tried and more over the last two days. Somehow I didn't see this SO thread (I wasn't using search terms 'divider', methinks).
What worked for me was to have the no window overlay property set to null. I see that setting the window color may work on some higher version of android (4.2.x+) as well, so I decided to set both. Here is the SO link with the solution(s) to this nasty feature (bug?): link
My final values-v11/themes.xml -
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Application theme. -->
<style name="ActionTheme" parent="#style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/ActionBarStyle</item>
<item name="android:windowActionBar">true</item>
<item name="android:windowBackground">#android:color/white</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="ActionBarStyle" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:displayOptions"></item>
<item name="android:background">#drawable/header_style</item>
<item name="android:titleTextStyle">#style/ActionBarTitleText</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:height">70dp</item>
</style>
<style name="ActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/color_dark_blue</item>
</style>
</resources>
If user2545146 answer doesn't work on lollipop.
call setElevation on the actionbar from the activity.
getSupportActionBar().setElevation(0);
The only thing that worked for me was
AppBarLayout appBarLayout = findViewById(R.id.my_app_bar_layout);
appBarLayout.setOutlineProvider(null);
api >= 21 only
I am using Android Navigation bar in my project,
I want to change the top color in action bar to something red, How can i do that?
I have something like this,
and i want something like this,
how can i achieve that?
You can define the color of the ActionBar (and other stuff) by creating a custom Style:
Simply edit the res/values/styles.xml file of your Android project.
For example like this:
<resources>
<style name="MyCustomTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBarTheme</item>
</style>
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">ANY_HEX_COLOR_CODE</item>
</style>
</resources>
Then set "MyCustomTheme" as the Theme of your Activity that contains the ActionBar.
You can also set a color for the ActionBar like this:
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(Color.RED)); // set your desired color
Taken from here: How do I change the background color of the ActionBar of an ActionBarActivity using XML?
In general Android OS leverages a “theme” to allow app developers to globally apply a universal set of UI element styling parameters to Android applications as a whole, or, alternatively, to a single Activity subclass.
So there are three mainstream Android OS “system themes,” which you can specify in your Android Manifest XML file when you are developing apps for Version 3.0 and later versions
I am referring the (APPCOMPAT)support library here:--
So the three themes are
1. AppCompat Light Theme (Theme.AppCompat.Light)
AppCompat Dark Theme(Theme.AppCompat),
And a hybrid between these two ,AppCompat Light Theme with the Darker ActionBar.( Theme.AppCompat.Light.DarkActionBar)
AndroidManifest.xml and see the tag, the android theme is mentioned as:-- android:theme="#style/AppTheme"
Open the Styles.xml and we have base application theme declared there:--
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
We need to override these parent theme elements to style the action bar.
ActionBar with different color background:--
To do this we need to create a new style MyActionBar(you can give any name) with a parent reference to #style/Widget.AppCompat.Light.ActionBar.Solid.Inverse that holds the style characteristics for the Android ActionBar UI element. So definition would be
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/red</item>
</style>
And this definition we need to reference in our AppTheme, pointing to overridden ActionBar styling as--
#style/MyActionBar
Change the title bar text color (e.g black to white):--
Now to change the title text color, we need to override the parent reference parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
So the style definition would be
<style name="MyActionBarTitle" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/white</item>
</style>
We’ll reference this style definition inside the MyActionBar style definition, since the TitleTextStyle modification is a child element of an ActionBar parent OS UI element. So the final definition of MyActionBar style element will be
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/red</item>
<item name="titleTextStyle">#style/MyActionBarTitle</item>
</style>
SO this is the final Styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- This is the styling for action bar -->
<item name="actionBarStyle">#style/MyActionBar</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>
</resources>
For further ActionBar options Menu styling, refer this link
For Android 3.0 and higher only
When supporting Android 3.0 and higher only, you can define the action bar's background like this:
res/values/themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="#style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#ff0000</item>
</style>
</resources>
For Android 2.1 and higher
When using the Support Library, your style XML file might look like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/actionbar_background</item>
<!-- Support library compatibility -->
<item name="background">#drawable/actionbar_background</item>
</style>
</resources>
Then apply your theme to your entire app or individual activities:
for more details Documentaion
You can change action bar color on this way:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/green_action_bar</item>
</style>
Thats all you need for changing action bar color.
Plus if you want to change the status bar color just add the line:
<item name="android:colorPrimaryDark">#color/green_dark_action_bar</item>
Here is a screenshot taken from developer android site to make it more clear, and here is a link to read more about customizing the color palete
Another possibility of making.
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#0000ff")));
I can change ActionBar text color by using titleTextColor
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="titleTextColor">#333333</item>
</style>
Custom Color:
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/ColorPrimary</item>
<item name="colorPrimaryDark">#color/ColorPrimaryDark</item>
<!-- Customize your theme here. -->
</style>
Custom Style:
<style name="Theme.AndroidDevelopers" parent="android:style/Theme.Holo.Light">
<item name="android:selectableItemBackground">#drawable/ad_selectable_background</item>
<item name="android:popupMenuStyle">#style/MyPopupMenu</item>
<item name="android:dropDownListViewStyle">#style/MyDropDownListView</item>
<item name="android:actionBarTabStyle">#style/MyActionBarTabStyle</item>
<item name="android:actionDropDownStyle">#style/MyDropDownNav</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/ad_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">#drawable/ad_btn_radio_holo_light</item>
</style>
For More: Android ActionBar
As I was using AppCompatActivity above answers didn't worked for me. But the below solution worked:
In res/styles.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
</style>
PS: I've used colorPrimary instead of android:colorPrimary
in the style.xml add this code
<resources>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyAction</item>
</style>
<style name="MyActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#333333</item>
</style>
</resources>
Use this - http://jgilfelt.github.io/android-actionbarstylegenerator/
Good tool to customize your actionbar with a live preview in couple of minutes.