• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not everyone is using Jellybean yet, thus ActionBarSherlock

 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been told to use ActionBarSherlock for every app that I work on.
However I find that ABS increases the size of my apk.
What other options can I utilize to support Android 2.2+ up to the latest Jellybean OS ?
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a custom view I add to the layout when I am below HONEYCOMB. This view has the app icon, the app name, the same colors as the ActionBar, You can check your run-time version and have methods which are target above of below honeycomb. For example:



I have two layouts I use: one has a back arrow that you can use for 'up navigation' like you get on the Action Bar, the other does not. I generally do not put menu items on the custom title bar (although I think you could) because I think folks who have the older software expect the menu to be in the area provided by the menu button.
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That solution is obviously very basic. You can use it to provide a consistent L&F, but you don't get all the functionality of the ActionBar - tabs, spinner selector, etc... If you want them you could roll your own but then - that is why ActionBarSherlock was created - so you don't have to.
 
D. Smith
Author
Greenhorn
Posts: 25
5
Android IntelliJ IDE Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
However I find that ABS increases the size of my apk.


This statement is true of any library that you add to your code, and is the tradeoff for doing so. One of the reasons ABS in particular is larger than some is because it needs to bundle up all the resources necessary to display the ActionBar using the Holo style themes that don't exist prior to Android 3.0.

Creating a common view in your layout that "behaves" like an ActionBar is pretty straightforward, as Steve has already mentioned, it just requires the extra work to implement any of the other custom features (i.e. menu support) the framework provides. It also means that in the future when you want to support Android 3.0 and above, the work you have to go through to move to the native ActionBar will be more significant.

I have heard straight from the mouths of many Google engineers on the Android team over the past year that ABS is the best stop-gap available until older device support can be dropped. They have proposed a solution in the form of an AppCompat library that should be added to the current support library in a future release, but many of us are beginning to doubt that it will ever be released, or at least before Android 4.0 becomes dominant and the issue is no longer relevant.
 
Pho Tek
Ranch Hand
Posts: 782
Chrome Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Steve for your solution.
Although all the if statements might just push me to only target the new API levels & forget about the older devices.

@D. Smith, Thanks for your reply. Yes, I do hope that the ABS will slowly fade away.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic