Android custom action bar with different styles example

Android action bar by default comes with dark or Light theme, programmatically  styles can be changed by modifying styles.xml of values folder.

Note: We are using v7 appcompat support library, it support action bar in all the devices from API 7 onward.

To get Dark action bar in all the version of devices, just go to styles.xml in all folder and update parent theme to “Theme.AppCompat.Light.DarkActionBar” i.e

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
Dark action bar after changing styles

For Light action bar, update “Theme.AppCompat.Light” as parent theme in styles.xml in all the folder.

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
Light action bar after changing styles

To style action bar with custom color, visit actionbarstylegenerator & get the styles. Preview of styles will be visible. Many options can be customized like tabs, menus, background colors etc…

Android Action Bar Style Generator preview

Once its fully customized download & update the application folder accordingly.

Folders after updating the Styles

In manifest file, update the application theme name. Here Greenactionbar was the style name provided for generating style

        android:theme="@style/Theme.Greenactionbar" >
Green action bar