Details:
I'm extending ActionBarActivity.
Eclipse and SDK fully patched as of 2011-11-06.
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
Deployed to Samsung device with Android 2.3.3
Application has android:theme="@android:style/Theme.Light"
Issue: application is light, but ActionBar is blue with grey icons, hardly visible against the blue background color. I also want the ActionBar to be light, so they grey icons are more visible.
I've tried modifying the styles but to no avail.
I'm probably missing something trivial.
How do I change the background color of the ActionBar of an ActionBarActivity using XML ?
To set Android Button background color, we can assign android:backgroundTint XML attribute for Button in layout file with the required Color Value. To programmatically set or change Android Button background color, we may call pass the method Button.
As per documentation - "You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11)."
So, ActionBar will not work for your target environment which is at API level 10 (Android 2.3.3).
Just in case, 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.
Try this
ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable("COLOR"));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With