Methods Summary |
---|
public abstract void | addOnMenuVisibilityListener(android.support.v7.app.ActionBar$OnMenuVisibilityListener listener)Add a listener that will respond to menu visibility change events.
|
public abstract void | addTab(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.
|
public abstract void | addTab(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.
|
public abstract void | addTab(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.
|
public abstract void | addTab(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 .
|
public boolean | collapseActionView()
return false;
|
public void | dispatchMenuVisibilityChanged(boolean visible)
|
public abstract android.view.View | getCustomView()
|
public abstract int | getDisplayOptions()
|
public float | getElevation()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 0;
|
public abstract int | getHeight()Retrieve the current height of the ActionBar.
|
public int | getHideOffset()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 0;
|
public abstract int | getNavigationItemCount()Get the number of navigation items present in the current navigation mode.
|
public abstract int | getNavigationMode()Returns the current navigation mode. The result will be one of:
- {@link #NAVIGATION_MODE_STANDARD}
- {@link #NAVIGATION_MODE_LIST}
- {@link #NAVIGATION_MODE_TABS}
|
public abstract int | getSelectedNavigationIndex()Get the position of the selected navigation item in list or tabbed navigation modes.
|
public abstract android.support.v7.app.ActionBar$Tab | getSelectedTab()Returns the currently selected tab if in tabbed navigation mode and there is at least
one tab present.
|
public abstract java.lang.CharSequence | getSubtitle()Returns the current ActionBar subtitle in standard mode.
Returns null if {@link #getNavigationMode()} would not return
{@link #NAVIGATION_MODE_STANDARD}.
|
public abstract android.support.v7.app.ActionBar$Tab | getTabAt(int index)Returns the tab at the specified index.
|
public abstract int | getTabCount()Returns the number of tabs currently registered with the action bar.
|
public android.content.Context | getThemedContext()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 null;
|
public abstract java.lang.CharSequence | getTitle()Returns the current ActionBar title in standard mode.
Returns null if {@link #getNavigationMode()} would not return
{@link #NAVIGATION_MODE_STANDARD}.
|
public abstract void | hide()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 boolean | invalidateOptionsMenu()
return false;
|
public boolean | isHideOnContentScrollEnabled()Return whether the action bar is configured to scroll out of sight along with
a {@link View#setNestedScrollingEnabled(boolean) nested scrolling child}.
return false;
|
public abstract boolean | isShowing()
|
public boolean | isTitleTruncated()Returns true if the Title field has been truncated during layout for lack
of available space. return false;
|
public abstract android.support.v7.app.ActionBar$Tab | newTab()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}
|
public void | onConfigurationChanged(android.content.res.Configuration config)
|
public boolean | onKeyShortcut(int keyCode, android.view.KeyEvent ev)
return false;
|
public boolean | onMenuKeyEvent(android.view.KeyEvent event)
return false;
|
public boolean | openOptionsMenu()
return false;
|
public abstract void | removeAllTabs()Remove all tabs from the action bar and deselect the current tab.
|
public abstract void | removeOnMenuVisibilityListener(android.support.v7.app.ActionBar$OnMenuVisibilityListener listener)Remove a menu visibility listener. This listener will no longer receive menu
visibility change events.
|
public abstract void | removeTab(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.
|
public abstract void | removeTabAt(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.
|
public abstract void | selectTab(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)}.
|
public abstract void | setBackgroundDrawable(android.graphics.drawable.Drawable d)Set the ActionBar's background. This will be used for the primary
action bar.
|
public abstract void | setCustomView(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.
|
public abstract void | setCustomView(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.
|
public abstract void | setCustomView(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.
|
public void | setDefaultDisplayHomeAsUpEnabled(boolean enabled)
|
public abstract void | setDisplayHomeAsUpEnabled(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.
|
public abstract void | setDisplayOptions(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)}.
|
public abstract void | setDisplayOptions(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}.
|
public abstract void | setDisplayShowCustomEnabled(boolean showCustom)Set whether a custom view should be displayed, if set.
To set several display options at once, see the setDisplayOptions methods.
|
public abstract void | setDisplayShowHomeEnabled(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.
|
public abstract void | setDisplayShowTitleEnabled(boolean showTitle)Set whether an activity title/subtitle should be displayed.
To set several display options at once, see the setDisplayOptions methods.
|
public abstract void | setDisplayUseLogoEnabled(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.
|
public void | setElevation(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.
if (elevation != 0) {
throw new UnsupportedOperationException("Setting a non-zero elevation is " +
"not supported in this action bar configuration.");
}
|
public void | setHideOffset(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).
if (offset != 0) {
throw new UnsupportedOperationException("Setting an explicit action bar hide offset " +
"is not supported in this action bar configuration.");
}
|
public void | setHideOnContentScrollEnabled(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.
if (hideOnContentScroll) {
throw new UnsupportedOperationException("Hide on content scroll is not supported in " +
"this action bar configuration.");
}
|
public void | setHomeActionContentDescription(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.
|
public void | setHomeActionContentDescription(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.
|
public void | setHomeAsUpIndicator(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.
|
public void | setHomeAsUpIndicator(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.
|
public void | setHomeButtonEnabled(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.
|
public abstract void | setIcon(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}.
|
public abstract void | setIcon(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}.
|
public abstract void | setListNavigationCallbacks(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.
|
public abstract void | setLogo(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}.
|
public abstract void | setLogo(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}.
|
public abstract void | setNavigationMode(int mode)Set the current navigation mode.
|
public abstract void | setSelectedNavigationItem(int position)Set the selected navigation item in list or tabbed navigation modes.
|
public void | setShowHideAnimationEnabled(boolean enabled)
|
public void | setSplitBackgroundDrawable(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}
|
public void | setStackedBackgroundDrawable(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.
|
public abstract void | setSubtitle(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.
|
public abstract void | setSubtitle(int resId)Set the action bar's subtitle. This will only be displayed if
{@link #DISPLAY_SHOW_TITLE} is set.
|
public abstract void | setTitle(java.lang.CharSequence title)Set the action bar's title. This will only be displayed if
{@link #DISPLAY_SHOW_TITLE} is set.
|
public abstract void | setTitle(int resId)Set the action bar's title. This will only be displayed if
{@link #DISPLAY_SHOW_TITLE} is set.
|
public void | setWindowTitle(java.lang.CharSequence title)
|
public abstract void | show()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.ActionMode | startActionMode(ActionMode.Callback callback)
return null;
|