I'm working on an android project, in which i'm going to implement the tab layout, with TabHost, Fragment, and ViewPager.
By the way, I found some tutorial about the Sherlock Action Bar, and here is my question:
Is better the "native" code, or use this library?
What's your experience about this topic? And what's your suggestion?
Thanks.
If you're going to target an Android SDK version < 11 (Honeycomb 3.0), ActionBarSherlock is definitely better than ActionBarCompat, the official solution for backwards compatibility offered by Google. Otherwise if you're developing using only APIs >= 11 use the default ActionBar because ABS implements nothing more than that.
Here you can find an article written by Jake Wharton (the developer of ABS) where he discusses different ActionBar solutions pros and cons.
Short Answer:
If you want your application to look the same, including the action bar... then yes. It is NOT frowned upon, and Google mentions ABS all the time. From Google I/O to meetups in New York. ABS is always a recommended way to get compatibility with older devices/versions.
The Sherlock Action Bar is only to provide backwards support for API 10 and below. Above that you should use Action Bar since it was added in API 11 (3.0). So to answer your question, if you are targetting API 11 and up, use the native Action Bar, otherwise you will HAVE to use Action Bar Sherlock to get that look.
Here are the websites to both:
Action Bar
and
Action Bar Sherlock
Related
I'm trying to implement Sherlock ActionBar, but I'm not getting... Seems It's too old.
Does it have an equivalent ActionBar, or someone have a new tutorial ?
ActionBarSherlock was deprecated two years ago. Either use the native action bar that is part Android (from API Level 11 onwards), or use Google's appcompat-v7 action bar backport in the Android Support library. Both are covered in the documentation.
I want to use Action Bar in my applicaiton which has API level 8.
I want it like in this picture, on the top with some items in it.
http://i.stack.imgur.com/6tJ10.png
How can I do it?
Shadows answer is correct, but you can also use the appCompat support library, which is an official android support library (for what that's worth).
Use Action Bar Sherlock Library which supports for below versions too. You can integrate that in your project and do your stuff.
you can use ActionBarSherlock library.
or using android support library
I was using ActionBarSherlock to make my app run with app version of android and use actionbar, but now I don't need to support the old version and it is enough for me to support 4 and above , is there any benefit of ActionBarSherlock still for my case ?
Not really. Feel free to use the native API Level 11+ implementation of the action bar.
Note, though, that some things in Android may steer you in the direction of using an action bar backport... though the appcompat one published by Google, not ActionBarSherlock. For example, the recommended version of MediaRouteActionButton requires the appcompat action bar, though I am maintaining a port that works with the regular action bar.
The application currently has tabulations and bar custom made (by previous guy) from fragments to copy cat Apple design.
I want to move toward Android action bar to provide Android experience and usual behavior.
Should I implement Action Bar Sherlock or Action Bar Compat?
Pro ABS:
Lots of documentation
Action bar Tabs is well known (that's what I need to do)
About Holo theme? ABS is great to support it, how perform ABCompat?
Pro ABCompat:
Supported by Google (better in the long run?)
Better connection with navigation drawer (but I will not use one)
No external dependencies in Java Build path
What others arguments help decide? Which one should I pick ?
From my point of view, provided I succeed to do a action bar with fixed tabs, the Action Bar compatibility is the best choice (but not by much).
Thank you for helping me! (even providing arguments I missed)
The main reason that made me switch to ActionBarCompat is the Menu appearence in devices with android <= 2.3. With ActionBarSherlock, the menu appears very ugly, with the default menu of the device. With the ActionBarCompat, the menu appears the same way it appears when you open it in devices with Android >= 4.0 and hardware menu key.
But, be aware that the ActionBarCompat has some bugs to be resolved yet. I'm dealing with this bug:
SearchView taking all the space in the new ActionBarCompat
UPDATE:
Another bug:
https://code.google.com/p/android/issues/detail?id=58321&thanks=58321&ts=1375277660
UPDATE:
I've created a patched version of the ActionBarCompat to solve the issue with the ActionMode. See here:
The ActionMode is being created twice with the ActionBarCompat r18
The reasons why I migrated my app from ABS to Action Bar Compat were as follows:
I have only a very basic implementation of action bar tabs and I could see it would be simple to migrate
I prefer the Google documentation - it is clearer and more complete
Software maintenance will be simpler and less error prone because I now have no external dependencies.
I had run into a problem with ABS whereby I wanted to handle an orientation change (but you can't because of the way ABS hooks in to Android).
I haven't seen any statements from anybody connected with ABS about their long term plans for ABS. So I'm not convinced they are going to continue to support it. I may be wrong - but I haven't seen anything.
Performance is not really an issue for me, but I can't see why Google's "native" implementation would run slower than ABS and I suspect that it may perform better.
These are just my personal impressions.
I think that ActionBarSherlock was a brilliant piece of work, and a great service to Android developers. (By the way I don't have shares in Jake Wharton its developer.) Google have paid it the best compliment possible by including something that does essentially the same thing in essentially the same way (as far as I can tell) in the v7 support library.
But now that the functionality is officially supported some standard arguments apply as to which to choose.
ActionBarSherlock is a third party dependency, which represents a risk in terms of ongoing support. Unless it does something you really need that is not done by ActionBarCompat, or the latter has a bug which you can't work around or wait for a fix for, there's very little argument in favour of sticking with the former.
I recently migrated from ActionBarSherlock to ActionBarCompat and found only one or two minor issues, the main one being that a minor adjustment was required to the stock 9-patch images used for the action bar tab indicator backgrounds, in order to produce the standard tab behaviour on earlier android versions, in my case 2.2==API level 8==Froyo. (Specifically I adjusted the vertical stretchable regions so that they were not adjacent either to the top edge or the colored indicator bar at the bottom of the image.)
I recently read about the action bar implementation in android in the dev site.But i found that it requires a minimum api level of 11.Can someone tell me whether it is possible to implement action bar in Api levels less than 11 such as 8 or 9.If yes how can i do this?
ActionBarSherlock at http://actionbarsherlock.com is an Android library for implementing the action bar design pattern using the native ActionBar on 3.0+ and a third-party library on pre-3.0.
There is now also ActionBarCompat - part of the Android Support Library: http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html
There are third-party implementations of the action bar available. See this library project at github: android-actionbar. The manifest says the minimum API level is 3, target API is 8.
If you are looking for a simplistic Actionbar solution you might want to give a look to ActionBarCompat from the Google Official examples