Lab 8
Lab 8
• Action bar is a widget that replace the title bar at the top of every
Activity displaying navigation and important functionality of an
application.
• By default the Action bar includes the application logo on the left side,
followed by activity title, and menu items on the right side.
• It provide a constant UI of an application.
• It also used to provide a quick link to the application
Using the ActionBar Continue
Action bar provide the following features:
Customize the title bar of an activity
Follows its own life cycle.
Consistently displays frequently used actions of an application.
Appears in three standard forms: standard, tabbed, and list
Makes it possible to use the application icon or logo for navigation
Enabling the Actionbar
The action bar is enabled if an application uses default Theme.Holo theme
and whose target SDK is 11 or higher
Example
<uses-sdk android:targetSdkVersion=“13” />
Displaying Action Items
• To display menu items in the ActionBar as action item, we need to
add an android:showAsAction attribute to the menu items while
defining them in the menu file.
Always– makes the action item appear on the action bar
ifRoom--- make the action item appear in the action bar but only if
there is room available on the action bar. If there is no room then
item appear in the overflow menu
Never--- makes the menu item appear in the overflow menu
Check Manifest.xml
Displaying Action Screen Shot
How to Hide or show etc XML code
How to Hide or show etc XML code second Activity
How to Hide or show etc Java code MainActivity
How to Hide or show etc Java code second Activity