--- title: Theming layout: default ---
Theming of the action bar to work on both pre-3.0 and 3.0+ devices is a very straightforward and simple process. You should follow the existing theming recommendations for customizing the native action bar except for what is noted below.
An example of a customized action bar can be seen in the “Styled” application on the samples page.
In order for the action bar to function on pre-3.0 devices your activity must use Theme.Sherlock
or Theme.Sherlock.Light
, or your custom theme must use one of the aforementioned two as its parent.
These two themes serve as baseline configurations for the pre-3.0 action bar as well as mapping the attributes to their native versions on 3.0+.
The themes should be defined in your manifest for the entire application or on a per-activity basis. You may also define the theme in the code of each activity before calling super.onCreate(Bundle)
. This must be done for every activity on which you extend from FragmentActivity
and intend to use the action bar. More information on how to specify a theme can be found in the official Android documentation.
ActionBarSherlock themes expose non-namespaced versions of the action bar-related attributes which are used to style various elements. Each attribute has an appropriate default value set in the two parent themes so that you may only override the value you wish to change.
actionBarSize
- Height of the action bar container.actionBarTabStyle
- Style to change the appearance of the individual tabs.actionBarTabBarStyle
- Style to change the appearance of the tab bar.actionBarTabTextStyle
- Style to change the appearance of the tab text.actionButtonStyle
- Style to change the appearance of the action items.actionDropDownStyle
actionMenuTextAppearance
- Style to change the appearance of the action mode text.actionMenuTextColor
- Color of the action mode text.actionModeBackground
- Action mode background.actionModeCloseDrawable
- Drawable to use as the close button of an action mode.actionModeCloseButtonStyle
- Style to change the appearance of the action mode close button.actionOverflowButtonStyle
- Style to change the appearance of the overflow button.actionSpinnerItemStyle
dropDownListViewStyle
popupMenuStyle
selectableItemBackground
windowActionBar
- Boolean indicating whether to attach the action bar to the current activity or not.windowActionModeOverlay
- Boolean indicating whether an action mode should overlay the activity contents.There is also additional attributes which applies only to the pre-3.0 action bar to allow for specific customization that is not available on the native action bar.
actionHomeButtonStyle
- Style of the home button. This style should use Widget.Sherlock.ActionButton.Home
as its parent.homeAsUpIndicator
- Drawable to use to indicate that the home item will go "up" for the pre-3.0 action bar.abBackgroundStacked
- Drawable which is used on the tab bar when the action bar is stacked. This attribute is NOT reflected on Android 4.0+With version 3.1 of the library came new attributes directly in the theme to style the various feature of the action bar without using a seperate style.
abBackground
- Action bar background.abCustomNavigationLayout
- Layout resource for a custom navigaton view.abDisplayOptions
- Combination of one or more of: useLogo
, showHome
, homeAsUp
, showTitle
, and showCustom
.abDivider
- Drawable to use between action items on the pre-3.0 action bar.abHeight
- Action bar height (defaults to match actionBarSize
).abHomeLayout
- Layout to use for the home item.
abIcon
- Icon to display (defaults to activity icon).abIndeterminateProgressStyle
- Style to change the appearance of the indeterminate progress bar.
abItemPadding
- Padding to use on action items.
abLogo
- Logo to display when the appropriate flag is set.
abNavigationMode
- One of: normal
, listMode
, or tabMode
.abTitle
- Activity title (defaults to title specified in the manifest).abTitleTextStyle
- Style to change the appearance of the title text.abProgressBarPadding
- Padding to use on the determinate progress bar.
abProgressBarStyle
- Style to change the appearance of the determinate progress bar.abSubtitle
- Activity subtitle.abSubtitleTextStyle
- Style to change the appearance of the subtitle text.