Action Bar

The project describes How to implement Action Bar for your application. The Action Bar is a widget for activities that replaces the traditional title bar at the top of the screen. By default, the Action Bar includes the application logo on the left side, followed by the activity title, and any available items from the Options Menu on the right side.

Underlying Algorithm:

Basic description of algorithm in step by step form:

1.) Create a Project ActionBarExample
2.) Create and open the res/layout/main.xml file and insert the following:

 

 

 

3.) Make sure to add following in your manifest file:

 

 

 

“android:theme=”@android:style/Theme.NoTitleBar” will enable application to popup as action bar.

4.) Run the application.

Steps to Create:

1.) Open Eclipse. Use the New Project Wizard and select Android Project Give the respective project name i.e. ActionBarExample Enter following information:
Project name: ActionBarExample
Build Target: Android 2.3.3
Application name: ActionBarExample
Package name: org.example. ActionBarExample
Create Activity: ActionBarExample

On Clicking Finish ActionBarExample code structure is generated with the necessary Android Packages being imported along with ActionBarExample.java. Following code must be added in ActionBarExample class to get the menu to work.

 

 

 

Output –The final output:

Leave a Comment:

4 comments
Felipe Marques says November 24, 2011

thank you so much! You do not know if it helped me!

Reply
fermenter says December 1, 2011

does not work, project has errors with regard to @drawable/icon

Reply
hash says February 14, 2012

nice article

Reply
Unknown says March 2, 2012

This is very well. I love it.

Reply
Add Your Reply