Introduction to ActionBar Lesson 1

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.