Tuesday 15 May 2012

Android Customize ActionBar Color? -



Android Customize ActionBar Color? -

what want? want create actionbar color customizable, users can select color list of colors , actionbar color changed selected color.

what have done? have class named settingsactivity in take color selection user. color select stored in sharedpreferences. color user selected getting stored in sharedpreferences , restart application through intent color alter take place. working should.

but there problem whenever start application little interval of time app shows default color have @ styles.xml in values v-14 folder , color changes user selected color. how can eliminate bug?

i'm attaching code of styles.xml. if other detail or code required allow me know provide , using navigation drawer fragments.

<resources> <!-- base of operations application theme api 14+. theme replaces appbasetheme both res/values/styles.xml , res/values-v11/styles.xml on api 14+ devices. <style name="appbasetheme" parent="theme.appcompat.light.darkactionbar"> api 14 theme customizations can go here. </style> --> <style name="appbasetheme" parent="theme.appcompat.light.darkactionbar"> <!-- api 14 theme customizations can go here. --> <item name="android:actionbarstyle">@style/myactionbar</item> </style> <style name="myactionbar" parent="@android:style/widget.holo.light.actionbar"> <item name="android:background">#f39c12</item> </style> </resources>

use alter action bar color:_

actionbar bar = getactionbar(); bar.setbackgrounddrawable(new colordrawable("color"));

or utilize one

colordrawable colordrawable = new colordrawable(color.parsecolor("#fffebb31")); actionbar.setbackgrounddrawable(colordrawable);

thanks

android colors android-actionbar customization android-theme

No comments:

Post a Comment