Action Bar – AB            &ActionBarSherlock - ABS
Content  Action Bar  General Organization Action Bar  Split Action Bar  Contextual Action Bar  ActionBarSherlock   R...
Action bar The action bar is a window feature that identify the application and user location, and provides user actions ...
Backward Compatibility ActionBar class is not available in older versions of Android (< 3.0). Alternate: ActionBarSherlo...
General Organization1. App Icon2. View Control3. Action Buttons4. Action Overflow
1. App Icon Establishes apps identity Displays Up caret to the left of the app icon, to navigate up the hierarchy.
2. View control If your app displays data in different views, this segment of the action bar allows users to switch views...
3. Action Buttons Action buttons on the action bar surface your apps most important activities. Actions that dont fit in...
4. Action overflow Action overflow provides access to frequently used  actions. The overflow icon only appears on phones...
Split Action Bars    There are three possible locations to split action     bar content.    1. Main action bar    2. Top ...
AB on Different Screen Sizes            Gmail App
How many items will fit in the mainaction bar? Action buttons in the main action bar may not occupy more than 50% of the ...
How many actions will fit in themain action bar? Density-independent pixels (dp) determine the number of items in action ...
Contextual Action Bar A contextual action bar (CAB) is a temporary action bar. It overlays the apps action bar for the d...
Contextual Action Bar Like normal Action Bar, CAB also support split action bar. ActionMode represents a contextual mode...
Contextual Action Bar
ActionBarSherlock (ABS) ActionBarSherlock is a standalone library. It allows developer to develop apps with action bar o...
ActionBarSherlock (ABS) The library will automatically use native Action Bar implementation on Android 4.0 or above. On ...
ABS Requirements It is required that both ABS library and your project are compiled with Android 4.0 or newer. It is als...
ABS Theme Requirements The ABS library provides three core themes.   Theme.Sherlock   Theme.Sherlock.Light   Theme.She...
Native AB VS ABSNative AB classes    ABS library classes Activity            SherlockActivity FragmentActivity    Sher...
ABS Common Imports Ensure that you are using these types where appropriate   com.actionbarsherlock.app.ActionBar   com....
ABS and Proguard Add the following lines in proguard.cfg, to ensure proper functionality of the library:  -keep class and...
Action Bar – Menu xml Create XML file in /res/menu/my_menu
Action Bar
Action Bar
Menu Item
Split Action Bar Update AndroidManifest.xml
Tabs
ActionMode (CAB)
What else ? Action Providers i.e.        Search     Settings     Share Action Provider    Overlay Navigation Mode   ...
Summary Native Action bar - Introduced in Android API 11    (Android 3.0 Honeycomb)   ActionBarSherlock support API 2.x ...
Questions
Action bar & ActionBarSherlock
Action bar & ActionBarSherlock
Upcoming SlideShare
Loading in …5
×

Action bar & ActionBarSherlock

11,278 views

Published on

Presentation @ Coeus-Solutions Lahore - Feb 2013

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
11,278
On SlideShare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
182
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Action bar & ActionBarSherlock

  1. 1. Action Bar – AB &ActionBarSherlock - ABS
  2. 2. Content  Action Bar  General Organization Action Bar  Split Action Bar  Contextual Action Bar  ActionBarSherlock  Requirements  Code Snippets  Summary  Questions
  3. 3. Action bar The action bar is a window feature that identify the application and user location, and provides user actions and navigation modes Action bar offers users a consistent interface across application. Introduced in API level 11 (Android 3.0 Honeycomb)
  4. 4. Backward Compatibility ActionBar class is not available in older versions of Android (< 3.0). Alternate: ActionBarSherlock (ABS) library helps creating Action bar, back up to android 2.x Other option: Action Bar Compatibility (see sample app in API Demos)
  5. 5. General Organization1. App Icon2. View Control3. Action Buttons4. Action Overflow
  6. 6. 1. App Icon Establishes apps identity Displays Up caret to the left of the app icon, to navigate up the hierarchy.
  7. 7. 2. View control If your app displays data in different views, this segment of the action bar allows users to switch views. i. Drop-down menus ii. Tab controls iii. Custom Navigation App title or longer branding information can also use this space.
  8. 8. 3. Action Buttons Action buttons on the action bar surface your apps most important activities. Actions that dont fit in the action bar are moved automatically to the action overflow. Action buttons used throughout the Gmail application
  9. 9. 4. Action overflow Action overflow provides access to frequently used actions. The overflow icon only appears on phones that have no menu hardware keys. Phones with menu keys display the action overflow when the user presses the key. Action overflow is pinned to the right side.
  10. 10. Split Action Bars There are three possible locations to split action bar content. 1. Main action bar 2. Top bar 3. Bottom bar Note: Available on Android 4.0 (API level 14) and higher, for native AB, or use ABS for backward compatibility
  11. 11. AB on Different Screen Sizes Gmail App
  12. 12. How many items will fit in the mainaction bar? Action buttons in the main action bar may not occupy more than 50% of the bars width. Action buttons on bottom action bars can use the entire width.
  13. 13. How many actions will fit in themain action bar? Density-independent pixels (dp) determine the number of items in action bar. smaller than 360 dp = 2 icons 360-499 dp = 3 icons 500-599 dp = 4 icons 600 dp and larger = 5 icons
  14. 14. Contextual Action Bar A contextual action bar (CAB) is a temporary action bar. It overlays the apps action bar for the duration of a particular sub-task. CABs are most typically used for tasks that involve acting on selected data or text.
  15. 15. Contextual Action Bar Like normal Action Bar, CAB also support split action bar. ActionMode represents a contextual mode (or CAB) of the user interface. Dismiss the CAB via i. Navigation bars Back button ii. CABs checkmark button
  16. 16. Contextual Action Bar
  17. 17. ActionBarSherlock (ABS) ActionBarSherlock is a standalone library. It allows developer to develop apps with action bar on Android API level 2.x and up. Current version: 4.2.0 — 08-10-2012 Developed by : Jake Wharton
  18. 18. ActionBarSherlock (ABS) The library will automatically use native Action Bar implementation on Android 4.0 or above. On Android 3.x (Honeycomb), app will prefer ABS over native Action Bar.
  19. 19. ABS Requirements It is required that both ABS library and your project are compiled with Android 4.0 or newer. It is also required that you are compiling with JDK 1.6 in both, your editor and build systems.
  20. 20. ABS Theme Requirements The ABS library provides three core themes.  Theme.Sherlock  Theme.Sherlock.Light  Theme.Sherlock.Light.DarkActionBar One of above theme is must for all activities having action bar. Custom Theme
  21. 21. Native AB VS ABSNative AB classes ABS library classes Activity  SherlockActivity FragmentActivity  SherlockFragmentActivity Fragment  SherlockFragment ListFragment  SherlockListFragment ListActivity  SherlockListActivity DialogFragment  SherlockDialogFragment
  22. 22. ABS Common Imports Ensure that you are using these types where appropriate  com.actionbarsherlock.app.ActionBar  com.actionbarsherlock.view.Menu  com.actionbarsherlock.view.MenuItem  com.actionbarsherlock.view.MenuInflater Note: ABS contain same classes that are named same as their native counterparts
  23. 23. ABS and Proguard Add the following lines in proguard.cfg, to ensure proper functionality of the library: -keep class android.support.v4.app.** { *; } -keep interface android.support.v4.app.** { *; } -keep class com.actionbarsherlock.** { *; } -keep interface com.actionbarsherlock.** { *; } -keep attributes *Annotation*
  24. 24. Action Bar – Menu xml Create XML file in /res/menu/my_menu
  25. 25. Action Bar
  26. 26. Action Bar
  27. 27. Menu Item
  28. 28. Split Action Bar Update AndroidManifest.xml
  29. 29. Tabs
  30. 30. ActionMode (CAB)
  31. 31. What else ? Action Providers i.e.  Search  Settings  Share Action Provider  Overlay Navigation Mode  Static Attachment  No need to extend Progress SherlockActivity etc  Indeterminate Progress  Implement  Horizontal Progress Bar OnCreateOptionsMenuListe ner
  32. 32. Summary Native Action bar - Introduced in Android API 11 (Android 3.0 Honeycomb) ActionBarSherlock support API 2.x and above. ABS library will automatically use native Action Bar implementation on Android 4.0 or above. Be careful while importing classes, ABS have same class names as native AB. Split Action bar Contextual Action bar
  33. 33. Questions

×