Wednesday 15 August 2012

Change an action bar color in Android -


This question already asks on the stack overflow, but did not work for me.

I want to change my action bar color just like a Facebook app, the top action is in blue and the rest has a white background color.

I tried to use the post in the stack overflow, but it changes my entire activity color instead of just white instead of the action bar.

Here's my style. Xml and

  & lt; Style name = "custom capability theme" parent = "@ android: style / theme. Holo" & gt; & Lt; Item name = "Android: ActionBarbaby Style" & gt; @color / bluebase & lt; / Item & gt; & Lt ;! - Other activity and action bar styles here - & gt; & Lt; / Style & gt;   

manifest.xml

  & lt; Application Android: allowBackup = "true" android: icon = "@drawable / ic_luncher" android: label = "@ string / app_name" android: theme = "@ style / custom capabilityTheme" & gt;   

Thanks.

You can not use color directly, you have to use drawables: < P> action_bar_bg.xml :

  & lt; Size xmlns: android = "http: // schemas android.com/apk/res/android"> & Lt; Solid Android: Color = "@color / blue_base" /> & Lt; / Size & gt;   

Then it should work:

  & lt; Item name = "Android: ActionBarbaby Style" & gt; @drawable / action_bar_bug & lt; / Item & gt;    

No comments:

Post a Comment