SlideShare a Scribd company logo
Action Bar – AB
            &
ActionBarSherlock - ABS
Content
  Action Bar
  General Organization Action Bar
  Split Action Bar
  Contextual Action Bar
  ActionBarSherlock
   Requirements
  Code Snippets
  Summary
  Questions
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)
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)
General Organization



1. App Icon
2. View Control
3. Action Buttons
4. Action Overflow
1. App Icon
 Establishes app's 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.
  i.     Drop-down menus
  ii.    Tab controls
  iii.   Custom Navigation

 App title or longer branding information can also
 use this space.
3. Action Buttons
 Action buttons on the action bar surface your
 app's most important activities.

 Actions that don't fit in the action bar are moved
 automatically to the action overflow.




 Action buttons used throughout the Gmail application
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.
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
Action bar & ActionBarSherlock
AB on Different Screen Sizes




            Gmail App
How many items will fit in the main
action bar?

 Action buttons in the main action bar may not
 occupy more than 50% of the bar's width.

 Action buttons on bottom action bars can use the
 entire width.
How many actions will fit in the
main 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
Contextual Action Bar

 A contextual action bar (CAB) is a temporary
 action bar.

 It overlays the app's 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.
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 bar's Back button
  ii.   CAB's checkmark button
Contextual Action Bar
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
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.
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.
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
Native AB VS ABS
Native AB classes    ABS library classes


 Activity            SherlockActivity
 FragmentActivity    SherlockFragmentActivity
 Fragment            SherlockFragment
 ListFragment        SherlockListFragment
 ListActivity        SherlockListActivity
 DialogFragment      SherlockDialogFragment
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
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*
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)
Action bar & ActionBarSherlock
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
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
Questions
Ad

More Related Content

Similar to Action bar & ActionBarSherlock (20)

Android ui patterns
Android ui patternsAndroid ui patterns
Android ui patterns
vpulec
 
Android Setting Basic
Android Setting BasicAndroid Setting Basic
Android Setting Basic
Hosuk Shin
 
Android UI components walkthrough
Android UI components walkthroughAndroid UI components walkthrough
Android UI components walkthrough
Patrick Yin
 
PptABAPoverview with all sample data with proper information s and examples.ppt
PptABAPoverview with all sample data with proper information s and examples.pptPptABAPoverview with all sample data with proper information s and examples.ppt
PptABAPoverview with all sample data with proper information s and examples.ppt
PrabakaranDasarathan2
 
A Comprehensive Guide of Flutter AppBar Widget.pdf
A Comprehensive Guide of Flutter AppBar Widget.pdfA Comprehensive Guide of Flutter AppBar Widget.pdf
A Comprehensive Guide of Flutter AppBar Widget.pdf
getwidget
 
Modern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar aloneModern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar alone
Anton Rutkevich
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
Romain Guy
 
AppBar Class In Flutter.pptx
AppBar Class In Flutter.pptxAppBar Class In Flutter.pptx
AppBar Class In Flutter.pptx
BOSC Tech Labs
 
70 357 practice test
70 357 practice test70 357 practice test
70 357 practice test
shirlybaker1
 
Exploring Adobe Flex
Exploring Adobe Flex Exploring Adobe Flex
Exploring Adobe Flex
senthil0809
 
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Paris Android User Group
 
Calabash-iOS
Calabash-iOSCalabash-iOS
Calabash-iOS
Kishan Ravindra http://about.me/ravindra_kishan
 
Adobe MAX Recap
Adobe MAX RecapAdobe MAX Recap
Adobe MAX Recap
easelsolutions
 
Building a chatbot – step by step
Building a chatbot – step by stepBuilding a chatbot – step by step
Building a chatbot – step by step
CodeOps Technologies LLP
 
React native
React nativeReact native
React native
Mohammed El Rafie Tarabay
 
Developing for Mobile with Adobe AIR
Developing for Mobile with Adobe AIRDeveloping for Mobile with Adobe AIR
Developing for Mobile with Adobe AIR
Matthew Fabb
 
App design guide
App design guideApp design guide
App design guide
Jintin Lin
 
Beyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web InspectorBeyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web Inspector
Steven Roussey
 
Getting started with ibm worklight tips
Getting started with ibm worklight tipsGetting started with ibm worklight tips
Getting started with ibm worklight tips
bupbechanhgmail
 
AIR 3.0
AIR 3.0AIR 3.0
AIR 3.0
Christophe Keromen
 
Android ui patterns
Android ui patternsAndroid ui patterns
Android ui patterns
vpulec
 
Android Setting Basic
Android Setting BasicAndroid Setting Basic
Android Setting Basic
Hosuk Shin
 
Android UI components walkthrough
Android UI components walkthroughAndroid UI components walkthrough
Android UI components walkthrough
Patrick Yin
 
PptABAPoverview with all sample data with proper information s and examples.ppt
PptABAPoverview with all sample data with proper information s and examples.pptPptABAPoverview with all sample data with proper information s and examples.ppt
PptABAPoverview with all sample data with proper information s and examples.ppt
PrabakaranDasarathan2
 
A Comprehensive Guide of Flutter AppBar Widget.pdf
A Comprehensive Guide of Flutter AppBar Widget.pdfA Comprehensive Guide of Flutter AppBar Widget.pdf
A Comprehensive Guide of Flutter AppBar Widget.pdf
getwidget
 
Modern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar aloneModern Android UI, or not by Action Bar alone
Modern Android UI, or not by Action Bar alone
Anton Rutkevich
 
Google I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb HighlightsGoogle I/O 2011, Android Honeycomb Highlights
Google I/O 2011, Android Honeycomb Highlights
Romain Guy
 
AppBar Class In Flutter.pptx
AppBar Class In Flutter.pptxAppBar Class In Flutter.pptx
AppBar Class In Flutter.pptx
BOSC Tech Labs
 
70 357 practice test
70 357 practice test70 357 practice test
70 357 practice test
shirlybaker1
 
Exploring Adobe Flex
Exploring Adobe Flex Exploring Adobe Flex
Exploring Adobe Flex
senthil0809
 
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Introduction to Honeycomb APIs - Android Developer Lab 2011 Q3
Paris Android User Group
 
Developing for Mobile with Adobe AIR
Developing for Mobile with Adobe AIRDeveloping for Mobile with Adobe AIR
Developing for Mobile with Adobe AIR
Matthew Fabb
 
App design guide
App design guideApp design guide
App design guide
Jintin Lin
 
Beyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web InspectorBeyond the Basics, Debugging with Firebug and Web Inspector
Beyond the Basics, Debugging with Firebug and Web Inspector
Steven Roussey
 
Getting started with ibm worklight tips
Getting started with ibm worklight tipsGetting started with ibm worklight tips
Getting started with ibm worklight tips
bupbechanhgmail
 

Recently uploaded (20)

HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Semantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AISemantic Cultivators : The Critical Future Role to Enable AI
Semantic Cultivators : The Critical Future Role to Enable AI
artmondano
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptxDevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
DevOpsDays Atlanta 2025 - Building 10x Development Organizations.pptx
Justin Reock
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Ad

Action bar & ActionBarSherlock

  • 1. Action Bar – AB & ActionBarSherlock - ABS
  • 2. Content  Action Bar  General Organization Action Bar  Split Action Bar  Contextual Action Bar  ActionBarSherlock  Requirements  Code Snippets  Summary  Questions
  • 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. 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. General Organization 1. App Icon 2. View Control 3. Action Buttons 4. Action Overflow
  • 6. 1. App Icon  Establishes app's identity  Displays Up caret to the left of the app icon, to navigate up the hierarchy.
  • 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. 3. Action Buttons  Action buttons on the action bar surface your app's most important activities.  Actions that don't fit in the action bar are moved automatically to the action overflow. Action buttons used throughout the Gmail application
  • 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. 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
  • 12. AB on Different Screen Sizes Gmail App
  • 13. How many items will fit in the main action bar?  Action buttons in the main action bar may not occupy more than 50% of the bar's width.  Action buttons on bottom action bars can use the entire width.
  • 14. How many actions will fit in the main 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
  • 15. Contextual Action Bar  A contextual action bar (CAB) is a temporary action bar.  It overlays the app's 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.
  • 16. 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 bar's Back button ii. CAB's checkmark button
  • 18. 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
  • 19. 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.
  • 20. 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.
  • 21. 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
  • 22. Native AB VS ABS Native AB classes ABS library classes  Activity  SherlockActivity  FragmentActivity  SherlockFragmentActivity  Fragment  SherlockFragment  ListFragment  SherlockListFragment  ListActivity  SherlockListActivity  DialogFragment  SherlockDialogFragment
  • 23. 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
  • 24. 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*
  • 25. Action Bar – Menu xml  Create XML file in /res/menu/my_menu
  • 29. Split Action Bar  Update AndroidManifest.xml
  • 30. Tabs
  • 33. 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
  • 34. 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