belongs to Maven artifact com.android.support:appcompat-v7:28.0.0-alpha1
ActionBar
public
abstract
class
ActionBar
extends Object
java.lang.Object | |
↳ | android.support.v7.app.ActionBar |
A primary toolbar within the activity that may display the activity title, application-level navigation affordances, and other interactive items.
The action bar appears at the top of an activity's window when the activity uses the
AppCompat's AppCompat
theme (or one of its descendant themes).
You may otherwise add the action bar by calling requestFeature(FEATURE_SUPPORT_ACTION_BAR)
or by
declaring it in a custom theme with the
windowActionBar
property.
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
windowActionBar
attribute to
false
or otherwise not request the window feature.
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.
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 logo
in place of their standard title text.
From your activity, you can retrieve an instance of ActionBar
by calling getSupportActionBar()
getSupportActionBar()}.
In some cases, the action bar may be overlayed by another bar that enables contextual actions,
using an 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 ActionMode
APIs are distinct and independent from those for
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.
Summary
Nested classes | |
---|---|
class |
ActionBar.LayoutParams
Per-child layout information associated with action bar custom views. |
interface |
ActionBar.OnMenuVisibilityListener
Listener for receiving events when action bar menus are shown or hidden. |
interface |
ActionBar.OnNavigationListener
This interface was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. |
class |
ActionBar.Tab
This class was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. |
interface |
ActionBar.TabListener
This interface was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. |
Constants | |
---|---|
int |
DISPLAY_HOME_AS_UP
Display the 'home' element such that it appears as an 'up' affordance. |
int |
DISPLAY_SHOW_CUSTOM
Show the custom view if one has been set. |
int |
DISPLAY_SHOW_HOME
Show 'home' elements in this action bar, leaving more space for other navigation elements. |
int |
DISPLAY_SHOW_TITLE
Show the activity title and subtitle, if present. |
int |
DISPLAY_USE_LOGO
Use logo instead of icon if available. |
int |
NAVIGATION_MODE_LIST
This constant was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. |
int |
NAVIGATION_MODE_STANDARD
This constant was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other common navigation patterns instead. |
int |
NAVIGATION_MODE_TABS
This constant was deprecated in API level 24.1.0. Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other |