Introduction to ActionBar Lesson 1
. ActionBar Introduction
ActionBar is the title bar displayed on the top of the interface. Recommended by developers
ActionBar replaces OptionsMenu and TabHost.
Typical application methods include:
Use the application icon in the navigation bar to respond to the operation;
Display System menu (OptionsMenu)
Add a drop-down menu in the navigation bar;
Use the action control in the navigation bar;
Add a Tab );
Use ActionProvider.
(ActionProvider, the display and related functions of this Part are developed functions that can be directly used by developers)
Add and remove ActionBar
In Versions later than 3.0, ActionBar has been included in the Activity by default. Use the following code:
You can get the ActionBar object:
ActionBar actionbar = getActionBar ();
If you want to remove the ActionBar, you can select the NoActionBar topic in each series of topics.
When the getActionBar () method is called, the null value is obtained.
. Show () shows the ActionBar. (by default, the ActionBar is already displayed)
. Hide () hide ActionBar.
If you call ActionBar to create a Tab navigation, this navigation will also be hidden when you hide the ActionBar, because
This navigation is also part of the ActionBar and does not belong to the Activity
To hide the ActionBar but retain the Tab navigation, call the code that only hides the title bar.
ActionBar. setDisplayShowTitleEnabled (false );
ActionBar. setDisplayShowHomeEnabled (false)