FileDocCategorySizeDatePackage
ActionBar.javaAPI DocAndroid 5.1 API53048Thu Mar 12 22:22:56 GMT 2015android.support.v7.app

ActionBar

public abstract class ActionBar extends Object
A primary toolbar within the activity that may display the activity title, application-level navigation affordances, and other interactive items.

Beginning with Android 3.0 (API level 11), the action bar appears at the top of an activity's window when the activity uses the system's {@link android.R.style#Theme_Holo Holo} theme (or one of its descendant themes), which is the default. You may otherwise add the action bar by calling {@link android.view.Window#requestFeature requestFeature(FEATURE_ACTION_BAR)} or by declaring it in a custom theme with the {@link android.R.styleable#Theme_windowActionBar windowActionBar} property.

Beginning with Android L (API level 21), the action bar may be represented by any Toolbar widget within the application layout. The application may signal to the Activity which Toolbar should be treated as the Activity's action bar. Activities that use this feature should use one of the supplied .NoActionBar themes, set the {@link android.R.styleable#Theme_windowActionBar windowActionBar} attribute to false or otherwise not request the window feature.

By adjusting the window features requested by the theme and the layouts used for an Activity's content view, an app can use the standard system action bar on older platform releases and the newer inline toolbars on newer platform releases. The ActionBar object obtained from the Activity can be used to control either configuration transparently.

When using the Holo themes the action bar shows the application icon on the left, followed by the activity title. If your activity has an options menu, you can make select items accessible directly from the action bar as "action items". You can also modify various characteristics of the action bar or remove it completely.

When using the Material themes (default in API 21 or newer) the navigation button (formerly "Home") takes over the space previously occupied by the application icon. Apps wishing to express a stronger branding should use their brand colors heavily in the action bar and other application chrome or use a {@link #setLogo(int) logo} in place of their standard title text.

From your activity, you can retrieve an instance of {@link ActionBar} by calling {@link android.app.Activity#getActionBar getActionBar()}.

In some cases, the action bar may be overlayed by another bar that enables contextual actions, using an {@link android.view.ActionMode}. For example, when the user selects one or more items in your activity, you can enable an action mode that offers actions specific to the selected items, with a UI that temporarily replaces the action bar. Although the UI may occupy the same space, the {@link android.view.ActionMode} APIs are distinct and independent from those for {@link ActionBar}.

Developer Guides

For information about how to use the action bar, including how to add action items, navigation modes and more, read the Action Bar developer guide.

Fields Summary
public static final int
NAVIGATION_MODE_STANDARD
Standard navigation mode. Consists of either a logo or icon and title text with an optional subtitle. Clicking any of these elements will dispatch onOptionsItemSelected to the host Activity with a MenuItem with item ID android.R.id.home.
public static final int
NAVIGATION_MODE_LIST
List navigation mode. Instead of static title text this mode presents a list menu for navigation within the activity. e.g. this might be presented to the user as a dropdown list.
public static final int
NAVIGATION_MODE_TABS
Tab navigation mode. Instead of static title text this mode presents a series of tabs for navigation within the activity.
public static final int
DISPLAY_USE_LOGO
Use logo instead of icon if available. This flag will cause appropriate navigation modes to use a wider logo in place of the standard icon.
public static final int
DISPLAY_SHOW_HOME
Show 'home' elements in this action bar, leaving more space for other navigation elements. This includes logo and icon.
public static final int
DISPLAY_HOME_AS_UP
Display the 'home' element such that it appears as an 'up' affordance. e.g. show an arrow to the left indicating the action that will be taken. Set this flag if selecting the 'home' button in the action bar to return up by a single level in your UI rather than back to the top level or front page.

Setting this option will implicitly enable interaction with the home/up button. See {@link #setHomeButtonEnabled(boolean)}.

public static final int
DISPLAY_SHOW_TITLE
Show the activity title and subtitle, if present.
public static final int
DISPLAY_SHOW_CUSTOM
Show the custom view if one has been set.
Constructors Summary
Methods Summary
public abstract voidaddOnMenuVisibilityListener(android.support.v7.app.ActionBar$OnMenuVisibilityListener listener)
Add a listener that will respond to menu visibility change events.

param
listener The new listener to add

public abstract voidaddTab(android.support.v7.app.ActionBar$Tab tab)
Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list. If this is the first tab to be added it will become the selected tab.

param
tab Tab to add
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidaddTab(android.support.v7.app.ActionBar$Tab tab, boolean setSelected)
Add a tab for use in tabbed navigation mode. The tab will be added at the end of the list.

param
tab Tab to add
param
setSelected True if the added tab should become the selected tab.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidaddTab(android.support.v7.app.ActionBar$Tab tab, int position)
Add a tab for use in tabbed navigation mode. The tab will be inserted at position. If this is the first tab to be added it will become the selected tab.

param
tab The tab to add
param
position The new position of the tab
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidaddTab(android.support.v7.app.ActionBar$Tab tab, int position, boolean setSelected)
Add a tab for use in tabbed navigation mode. The tab will be insterted at position.

param
tab The tab to add
param
position The new position of the tab
param
setSelected True if the added tab should become the selected tab.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public booleancollapseActionView()

hide

        return false;
    
public voiddispatchMenuVisibilityChanged(boolean visible)

hide

    
public abstract android.view.ViewgetCustomView()

return
The current custom view.

public abstract intgetDisplayOptions()

return
The current set of display options.

public floatgetElevation()
Get the Z-axis elevation of the action bar in pixels.

The action bar's elevation is the distance it is placed from its parent surface. Higher values are closer to the user.

return
Elevation value in pixels

        return 0;
    
public abstract intgetHeight()
Retrieve the current height of the ActionBar.

return
The ActionBar's height

public intgetHideOffset()
Return the current vertical offset of the action bar.

The action bar's current hide offset is the distance that the action bar is currently scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's current measured {@link #getHeight() height} (fully invisible).

return
The action bar's offset toward its fully hidden state in pixels

        return 0;
    
public abstract intgetNavigationItemCount()
Get the number of navigation items present in the current navigation mode.

return
Number of navigation items.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract intgetNavigationMode()
Returns the current navigation mode. The result will be one of:
  • {@link #NAVIGATION_MODE_STANDARD}
  • {@link #NAVIGATION_MODE_LIST}
  • {@link #NAVIGATION_MODE_TABS}

return
The current navigation mode.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract intgetSelectedNavigationIndex()
Get the position of the selected navigation item in list or tabbed navigation modes.

return
Position of the selected item.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract android.support.v7.app.ActionBar$TabgetSelectedTab()
Returns the currently selected tab if in tabbed navigation mode and there is at least one tab present.

return
The currently selected tab or null
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract java.lang.CharSequencegetSubtitle()
Returns the current ActionBar subtitle in standard mode. Returns null if {@link #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}.

return
The current ActionBar subtitle or null.

public abstract android.support.v7.app.ActionBar$TabgetTabAt(int index)
Returns the tab at the specified index.

param
index Index value in the range 0-get
return
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract intgetTabCount()
Returns the number of tabs currently registered with the action bar.

return
Tab count
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public android.content.ContextgetThemedContext()
Returns a {@link Context} with an appropriate theme for creating views that will appear in the action bar. If you are inflating or instantiating custom views that will appear in an action bar, you should use the Context returned by this method. (This includes adapters used for list navigation mode.) This will ensure that views contrast properly against the action bar.

return
A themed Context for creating views

        return null;
    
public abstract java.lang.CharSequencegetTitle()
Returns the current ActionBar title in standard mode. Returns null if {@link #getNavigationMode()} would not return {@link #NAVIGATION_MODE_STANDARD}.

return
The current ActionBar title or null.

public abstract voidhide()
Hide the ActionBar if it is currently showing. If the window hosting the ActionBar does not have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application content to fit the new space available.

Instead of calling this function directly, you can also cause an ActionBar using the overlay feature to hide through {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}. Hiding the ActionBar through this system UI flag allows you to more seamlessly hide it in conjunction with other screen decorations.

public booleaninvalidateOptionsMenu()

hide

        return false;
    
public booleanisHideOnContentScrollEnabled()
Return whether the action bar is configured to scroll out of sight along with a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}.

return
true if hide-on-content-scroll is enabled
see
#setHideOnContentScrollEnabled(boolean)

        return false;
    
public abstract booleanisShowing()

return
true if the ActionBar is showing, false otherwise.

public booleanisTitleTruncated()
Returns true if the Title field has been truncated during layout for lack of available space.

return
true if the Title field has been truncated
hide
pending API approval

 return false; 
public abstract android.support.v7.app.ActionBar$TabnewTab()
Create and return a new {@link Tab}. This tab will not be included in the action bar until it is added.

Very often tabs will be used to switch between {@link Fragment} objects. Here is a typical implementation of such tabs:

{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java complete}

return
A new Tab
see
#addTab(Tab)
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public voidonConfigurationChanged(android.content.res.Configuration config)

hide

    
public booleanonKeyShortcut(int keyCode, android.view.KeyEvent ev)

hide

        return false;
    
public booleanonMenuKeyEvent(android.view.KeyEvent event)

hide

        return false;
    
public booleanopenOptionsMenu()

hide

        return false;
    
public abstract voidremoveAllTabs()
Remove all tabs from the action bar and deselect the current tab.

deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidremoveOnMenuVisibilityListener(android.support.v7.app.ActionBar$OnMenuVisibilityListener listener)
Remove a menu visibility listener. This listener will no longer receive menu visibility change events.

param
listener A listener to remove that was previously added

public abstract voidremoveTab(android.support.v7.app.ActionBar$Tab tab)
Remove a tab from the action bar. If the removed tab was selected it will be deselected and another tab will be selected if present.

param
tab The tab to remove
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidremoveTabAt(int position)
Remove a tab from the action bar. If the removed tab was selected it will be deselected and another tab will be selected if present.

param
position Position of the tab to remove
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidselectTab(android.support.v7.app.ActionBar$Tab tab)
Select the specified tab. If it is not a child of this action bar it will be added.

Note: If you want to select by index, use {@link #setSelectedNavigationItem(int)}.

param
tab Tab to select
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidsetBackgroundDrawable(android.graphics.drawable.Drawable d)
Set the ActionBar's background. This will be used for the primary action bar.

param
d Background drawable
see
#setStackedBackgroundDrawable(Drawable)
see
#setSplitBackgroundDrawable(Drawable)

public abstract voidsetCustomView(android.view.View view)
Set the action bar into custom navigation mode, supplying a view for custom navigation. Custom navigation views appear between the application icon and any action buttons and may use any space available there. Common use cases for custom navigation views might include an auto-suggesting address bar for a browser or other navigation mechanisms that do not translate well to provided navigation modes.

param
view Custom navigation view to place in the ActionBar.

public abstract voidsetCustomView(android.view.View view, android.support.v7.app.ActionBar$LayoutParams layoutParams)
Set the action bar into custom navigation mode, supplying a view for custom navigation.

Custom navigation views appear between the application icon and any action buttons and may use any space available there. Common use cases for custom navigation views might include an auto-suggesting address bar for a browser or other navigation mechanisms that do not translate well to provided navigation modes.

The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be displayed.

param
view Custom navigation view to place in the ActionBar.
param
layoutParams How this custom view should layout in the bar.
see
#setDisplayOptions(int, int)

public abstract voidsetCustomView(int resId)
Set the action bar into custom navigation mode, supplying a view for custom navigation.

Custom navigation views appear between the application icon and any action buttons and may use any space available there. Common use cases for custom navigation views might include an auto-suggesting address bar for a browser or other navigation mechanisms that do not translate well to provided navigation modes.

The display option {@link #DISPLAY_SHOW_CUSTOM} must be set for the custom view to be displayed.

param
resId Resource ID of a layout to inflate into the ActionBar.
see
#setDisplayOptions(int, int)

public voidsetDefaultDisplayHomeAsUpEnabled(boolean enabled)

hide

    
public abstract voidsetDisplayHomeAsUpEnabled(boolean showHomeAsUp)
Set whether home should be displayed as an "up" affordance. Set this to true if selecting "home" returns up by a single level in your UI rather than back to the top level or front page.

To set several display options at once, see the setDisplayOptions methods.

param
showHomeAsUp true to show the user that selecting home will return one level up rather than to the top level of the app.
see
#setDisplayOptions(int)
see
#setDisplayOptions(int, int)

public abstract voidsetDisplayOptions(int options)
Set display options. This changes all display option bits at once. To change a limited subset of display options, see {@link #setDisplayOptions(int, int)}.

param
options A combination of the bits defined by the DISPLAY_ constants defined in ActionBar.

public abstract voidsetDisplayOptions(int options, int mask)
Set selected display options. Only the options specified by mask will be changed. To change all display option bits at once, see {@link #setDisplayOptions(int)}.

Example: setDisplayOptions(0, DISPLAY_SHOW_HOME) will disable the {@link #DISPLAY_SHOW_HOME} option. setDisplayOptions(DISPLAY_SHOW_HOME, DISPLAY_SHOW_HOME | DISPLAY_USE_LOGO) will enable {@link #DISPLAY_SHOW_HOME} and disable {@link #DISPLAY_USE_LOGO}.

param
options A combination of the bits defined by the DISPLAY_ constants defined in ActionBar.
param
mask A bit mask declaring which display options should be changed.

public abstract voidsetDisplayShowCustomEnabled(boolean showCustom)
Set whether a custom view should be displayed, if set.

To set several display options at once, see the setDisplayOptions methods.

param
showCustom true if the currently set custom view should be displayed, false otherwise.
see
#setDisplayOptions(int)
see
#setDisplayOptions(int, int)

public abstract voidsetDisplayShowHomeEnabled(boolean showHome)
Set whether to include the application home affordance in the action bar. Home is presented as either an activity icon or logo.

To set several display options at once, see the setDisplayOptions methods.

param
showHome true to show home, false otherwise.
see
#setDisplayOptions(int)
see
#setDisplayOptions(int, int)

public abstract voidsetDisplayShowTitleEnabled(boolean showTitle)
Set whether an activity title/subtitle should be displayed.

To set several display options at once, see the setDisplayOptions methods.

param
showTitle true to display a title/subtitle if present.
see
#setDisplayOptions(int)
see
#setDisplayOptions(int, int)

public abstract voidsetDisplayUseLogoEnabled(boolean useLogo)
Set whether to display the activity logo rather than the activity icon. A logo is often a wider, more detailed image.

To set several display options at once, see the setDisplayOptions methods.

param
useLogo true to use the activity logo, false to use the activity icon.
see
#setDisplayOptions(int)
see
#setDisplayOptions(int, int)

public voidsetElevation(float elevation)
Set the Z-axis elevation of the action bar in pixels.

The action bar's elevation is the distance it is placed from its parent surface. Higher values are closer to the user.

param
elevation Elevation value in pixels

        if (elevation != 0) {
            throw new UnsupportedOperationException("Setting a non-zero elevation is " +
                    "not supported in this action bar configuration.");
        }
    
public voidsetHideOffset(int offset)
Set the current hide offset of the action bar.

The action bar's current hide offset is the distance that the action bar is currently scrolled offscreen in pixels. The valid range is 0 (fully visible) to the action bar's current measured {@link #getHeight() height} (fully invisible).

param
offset The action bar's offset toward its fully hidden state in pixels.

        if (offset != 0) {
            throw new UnsupportedOperationException("Setting an explicit action bar hide offset " +
                    "is not supported in this action bar configuration.");
        }
    
public voidsetHideOnContentScrollEnabled(boolean hideOnContentScroll)
Enable hiding the action bar on content scroll.

If enabled, the action bar will scroll out of sight along with a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child} view's content. The action bar must be in {@link Window#FEATURE_ACTION_BAR_OVERLAY overlay mode} to enable hiding on content scroll.

When partially scrolled off screen the action bar is considered {@link #hide() hidden}. A call to {@link #show() show} will cause it to return to full view.

param
hideOnContentScroll true to enable hiding on content scroll.

        if (hideOnContentScroll) {
            throw new UnsupportedOperationException("Hide on content scroll is not supported in " +
                    "this action bar configuration.");
        }
    
public voidsetHomeActionContentDescription(java.lang.CharSequence description)
Set an alternate description for the Home/Up action, when enabled.

This description is commonly used for accessibility/screen readers when the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) Examples of this are, "Navigate Home" or "Navigate Up" depending on the {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific functionality such as a sliding drawer, you should also set this to accurately describe the action.

Setting this to null will use the system default description.

param
description New description for the Home action when enabled
see
#setHomeAsUpIndicator(int)
see
#setHomeAsUpIndicator(android.graphics.drawable.Drawable)

public voidsetHomeActionContentDescription(int resId)
Set an alternate description for the Home/Up action, when enabled.

This description is commonly used for accessibility/screen readers when the Home action is enabled. (See {@link #setDisplayHomeAsUpEnabled(boolean)}.) Examples of this are, "Navigate Home" or "Navigate Up" depending on the {@link #DISPLAY_HOME_AS_UP} display option. If you have changed the home-as-up indicator using {@link #setHomeAsUpIndicator(int)} to indicate more specific functionality such as a sliding drawer, you should also set this to accurately describe the action.

Setting this to 0 will use the system default description.

param
resId Resource ID of a string to use as the new description for the Home action when enabled
see
#setHomeAsUpIndicator(int)
see
#setHomeAsUpIndicator(android.graphics.drawable.Drawable)

public voidsetHomeAsUpIndicator(android.graphics.drawable.Drawable indicator)
Set an alternate drawable to display next to the icon/logo/title when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using this mode to display an alternate selection for up navigation, such as a sliding drawer.

If you pass null to this method, the default drawable from the theme will be used.

If you implement alternate or intermediate behavior around Up, you should also call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} to provide a correct description of the action for accessibility support.

param
indicator A drawable to use for the up indicator, or null to use the theme's default
see
#setDisplayOptions(int, int)
see
#setDisplayHomeAsUpEnabled(boolean)
see
#setHomeActionContentDescription(int)

public voidsetHomeAsUpIndicator(int resId)
Set an alternate drawable to display next to the icon/logo/title when {@link #DISPLAY_HOME_AS_UP} is enabled. This can be useful if you are using this mode to display an alternate selection for up navigation, such as a sliding drawer.

If you pass 0 to this method, the default drawable from the theme will be used.

If you implement alternate or intermediate behavior around Up, you should also call {@link #setHomeActionContentDescription(int) setHomeActionContentDescription()} to provide a correct description of the action for accessibility support.

param
resId Resource ID of a drawable to use for the up indicator, or 0 to use the theme's default
see
#setDisplayOptions(int, int)
see
#setDisplayHomeAsUpEnabled(boolean)
see
#setHomeActionContentDescription(int)

public voidsetHomeButtonEnabled(boolean enabled)
Enable or disable the "home" button in the corner of the action bar. (Note that this is the application home/up affordance on the action bar, not the systemwide home button.)

This defaults to true for packages targeting < API 14. For packages targeting API 14 or greater, the application should call this method to enable interaction with the home/up affordance.

Setting the {@link #DISPLAY_HOME_AS_UP} display option will automatically enable the home button.

param
enabled true to enable the home button, false to disable the home button.

 
public abstract voidsetIcon(int resId)
Set the icon to display in the 'home' section of the action bar. The action bar will use an icon specified by its style or the activity icon by default. Whether the home section shows an icon or logo is controlled by the display option {@link #DISPLAY_USE_LOGO}.

param
resId Resource ID of a drawable to show as an icon.
see
#setDisplayUseLogoEnabled(boolean)
see
#setDisplayShowHomeEnabled(boolean)

public abstract voidsetIcon(android.graphics.drawable.Drawable icon)
Set the icon to display in the 'home' section of the action bar. The action bar will use an icon specified by its style or the activity icon by default. Whether the home section shows an icon or logo is controlled by the display option {@link #DISPLAY_USE_LOGO}.

param
icon Drawable to show as an icon.
see
#setDisplayUseLogoEnabled(boolean)
see
#setDisplayShowHomeEnabled(boolean)

public abstract voidsetListNavigationCallbacks(android.widget.SpinnerAdapter adapter, android.support.v7.app.ActionBar$OnNavigationListener callback)
Set the adapter and navigation callback for list navigation mode. The supplied adapter will provide views for the expanded list as well as the currently selected item. (These may be displayed differently.) The supplied OnNavigationListener will alert the application when the user changes the current list selection.

param
adapter An adapter that will provide views both to display the current navigation selection and populate views within the dropdown navigation menu.
param
callback An OnNavigationListener that will receive events when the user selects a navigation item.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidsetLogo(int resId)
Set the logo to display in the 'home' section of the action bar. The action bar will use a logo specified by its style or the activity logo by default. Whether the home section shows an icon or logo is controlled by the display option {@link #DISPLAY_USE_LOGO}.

param
resId Resource ID of a drawable to show as a logo.
see
#setDisplayUseLogoEnabled(boolean)
see
#setDisplayShowHomeEnabled(boolean)

public abstract voidsetLogo(android.graphics.drawable.Drawable logo)
Set the logo to display in the 'home' section of the action bar. The action bar will use a logo specified by its style or the activity logo by default. Whether the home section shows an icon or logo is controlled by the display option {@link #DISPLAY_USE_LOGO}.

param
logo Drawable to show as a logo.
see
#setDisplayUseLogoEnabled(boolean)
see
#setDisplayShowHomeEnabled(boolean)

public abstract voidsetNavigationMode(int mode)
Set the current navigation mode.

param
mode The new mode to set.
see
#NAVIGATION_MODE_STANDARD
see
#NAVIGATION_MODE_LIST
see
#NAVIGATION_MODE_TABS
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public abstract voidsetSelectedNavigationItem(int position)
Set the selected navigation item in list or tabbed navigation modes.

param
position Position of the item to select.
deprecated
Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead.

public voidsetShowHideAnimationEnabled(boolean enabled)

hide

    
public voidsetSplitBackgroundDrawable(android.graphics.drawable.Drawable d)
Set the ActionBar's split background. This will appear in the split action bar containing menu-provided action buttons on some devices and configurations.

You can enable split action bar with {@link android.R.attr#uiOptions}

param
d Background drawable for the split bar

 
public voidsetStackedBackgroundDrawable(android.graphics.drawable.Drawable d)
Set the ActionBar's stacked background. This will appear in the second row/stacked bar on some devices and configurations.

param
d Background drawable for the stacked row


                                                                                 
        

                                                                                                              
          

                                                                                                     
        

                                                                        
         

                                                                    
        

                                                                        
         

                                                                    
        

                                                                                                                                                                   
        
             

                                                   
        

                                                    
       

                                                 
       

                                  
        

                                      
         

                                          
        

                                      
        

                                                              
         

                                                                                                
            

                                                            
        

                                                       
        

                                                                                                         
        

                                          
        

                                                 
        

                              
         

                                   
         
public abstract voidsetSubtitle(java.lang.CharSequence subtitle)
Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is set. Set to null to disable the subtitle entirely.

param
subtitle Subtitle to set
see
#setSubtitle(int)
see
#setDisplayOptions(int, int)

public abstract voidsetSubtitle(int resId)
Set the action bar's subtitle. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is set.

param
resId Resource ID of subtitle string to set
see
#setSubtitle(CharSequence)
see
#setDisplayOptions(int, int)

public abstract voidsetTitle(java.lang.CharSequence title)
Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is set.

param
title Title to set
see
#setTitle(int)
see
#setDisplayOptions(int, int)

public abstract voidsetTitle(int resId)
Set the action bar's title. This will only be displayed if {@link #DISPLAY_SHOW_TITLE} is set.

param
resId Resource ID of title string to set
see
#setTitle(CharSequence)
see
#setDisplayOptions(int, int)

public voidsetWindowTitle(java.lang.CharSequence title)

hide

    
public abstract voidshow()
Show the ActionBar if it is not currently showing. If the window hosting the ActionBar does not have the feature {@link Window#FEATURE_ACTION_BAR_OVERLAY} it will resize application content to fit the new space available.

If you are hiding the ActionBar through {@link View#SYSTEM_UI_FLAG_FULLSCREEN View.SYSTEM_UI_FLAG_FULLSCREEN}, you should not call this function directly.

public android.support.v7.view.ActionModestartActionMode(ActionMode.Callback callback)

hide

        return null;