Your SlideShare is downloading. ×
0
Using Action Bar
Action Bar• The action bar is a window feature that identifies the  application and user location, and provides user actio...
Using ActionBarSherlock(ABS)  • To use ABS it has to be    imported in eclipse and    has to be an opened    project.  • C...
Using ActionBarSherlock(ABS) • Go to the build path   window of action bar   project. • Under Libraries tab add   jar ‘and...
Using ActionBarSherlock(ABS) • Now create a new   project in Eclipse   with minimum SDK   7 and set Build   target to 15.
Using ActionBarSherlock(ABS)• Go to the project properties  again and in the library  section add the Previous  created ‘A...
• Now we are ready to integrate  Action Bar.• To Enable Action Bar for any  activity, the Activity must  extend        ‘Sh...
Adding Menu in ActionBar• To add menu in ActionBar use menu like  optionsMenu.• Define in the XML but Add the tag  ‘showAs...
• Now       in   the       Activity’s  onCreateOptionsMenu()         use     getSupportMenuInflater() to get the menu infl...
• Here is the result
Upcoming SlideShare
Loading in...5
×

Action Bar Sherlock tutorial

70,326

Published on

Credit: Ashaduzzaman Rubel

Published in: Technology, Education
9 Comments
15 Likes
Statistics
Notes
No Downloads
Views
Total Views
70,326
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
708
Comments
9
Likes
15
Embeds 0
No embeds

No notes for slide

Transcript of "Action Bar Sherlock tutorial"

  1. 1. Using Action Bar
  2. 2. Action Bar• The action bar is a window feature that identifies the application and user location, and provides user actions and navigation modes.• You should use the action bar in most activities that need to prominently present user actions or global navigation.• You can control the behaviors and visibility of the action bar with the ActionBar APIs, which were added in Android 3.0 (API level 11).• To use ActionBar in previous Android versions there is a Library ‘ActionBarSherlock’ which can be downloaded from http://actionbarsherlock.com/• ActionBarSherlock supports from Android 2.0 and over.
  3. 3. Using ActionBarSherlock(ABS) • To use ABS it has to be imported in eclipse and has to be an opened project. • Create a new Android project in Eclipse. • In create project window select ‘Create project from existing source’ • In the location browse to the ‘library folder’ in ABS library which was downloaded.
  4. 4. Using ActionBarSherlock(ABS) • Go to the build path window of action bar project. • Under Libraries tab add jar ‘android-support- v4.jar’ which is already included in the libs folder. • Also set the build target to API 14 or higher. • Though ABS will be used with 2.0 or above it requires to be built with 4.0 or higher
  5. 5. Using ActionBarSherlock(ABS) • Now create a new project in Eclipse with minimum SDK 7 and set Build target to 15.
  6. 6. Using ActionBarSherlock(ABS)• Go to the project properties again and in the library section add the Previous created ‘ActionBarSherlock’ library• Since the action bar widget is very complex it requires a set of default themes. The library provides three core themes—one of which must be applied to each activity on which you want the action bar present.• In the Manifest set theme in the appication tag for all activities or or under specific Activities• ‘android:theme="@style/Theme.S herlock">’
  7. 7. • Now we are ready to integrate Action Bar.• To Enable Action Bar for any activity, the Activity must extend ‘SherlockActivity’ instead of ‘Activity’• To access ActionBar use getSupportActionBar() instead of getActionBar().
  8. 8. Adding Menu in ActionBar• To add menu in ActionBar use menu like optionsMenu.• Define in the XML but Add the tag ‘showAsAction’ and set it to ‘ifRoom’
  9. 9. • Now in the Activity’s onCreateOptionsMenu() use getSupportMenuInflater() to get the menu inflater and inflate the XML menu file• In the onOptionsItemSelect ed() do the necessary jobs identified menu items by ‘id‘ set in the XML file
  10. 10. • Here is the result
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×