How to implement the action bar in api levels less than 11? - android

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

Related

Using action bar in API 8

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

In Android do I need to support both compat Action Bar and regular one?

I have an old Android app that was target at API level 8 (2.2). I'm planning to update it to targetSDK 4.4.2. Main change will be using the Action Bar on pretty much every Activity. Right now it uses the old menu.
I know I have to use android.support.v7.app.ActionBar to support Action Bar for older phones.
Is it recommended to implement the "regular" android.app.ActionBar for APIs 11 and greater alongside android.support.v7.app.ActionBar?
Will they look any different?
No, you can use android.support.v7.app.ActionBar for all API levels.
Your ActionBar wont look different at all for APIs 11 or greater.
You can keep using android.support.v7.app.ActionBar.

Choosing Sherlock Actionbar over Support Libraries

Why should we choose using the Sherlock Action Bar in Android rather than the Support Libraries ? Is there a solid reason for using one above the other ?
Sherlock Action Bar purpose is to add the ActionBar visual concept implementation for API level below 11 (since ActionBar was added in API level 11). Taken from ActionBar javadoc: "A window feature at the top of the activity that may display the activity title, navigation modes, and other interactive items."
Support library (as the name describes) is a jar that provides APIs added in newer versions of Android to older ones. The best example I can think of is the Fragment implementation: Added in API level 11 made it so easy to integrate different parts of UI accross the application. But that was only for API level 11 above. So when the support library was released it provided this feature for API levels below 11.
So these 2 are separate concepts (one is for UI only, while the other is for supporting newer APIs in older Android versions). To add more, Sherlock AB uses support library.
The Support Libraries did not have compatibility for the Action Bar pre Support Library revision 18 and therefore the natural choice was the ActionBarSherlock library.
However as of revision 18 release in July sometime it is now supported, how good it is I am unsure as I have not used it but in future projects I will be leaning towards the Support Library as its supported by Google.
The link to the Support Library revision notes is here.
If I'm not mistaken, the ActionBar is only available in API 11+ and the support library do not include the an ActionBar Library for API < 11. ActionBarSherlock is a library that let's you support an ActionBar in API 7+.
PS: I believe google is gonna include a ActionBar API in the support library soon. So they said in Google I/O this year.
Update:
Google added ActionBar (for API 7+) in the support library.

Is recommended to use Sherlock Action Bar?

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

Action bar support in android support package revision 12

I am developing an Android application with Target SDK version 14 and minSdk version 10.
In SDK version we have support for Action Bars where as in API 10 we dont j=have support action bar.
Does android support library latest revision (android-support-v4 rev 12) has the support for Action bar and Popup menus ?
As i have written our application on API 14 and now we want to support API 10 aswell , Do we have another way to support action bars and popup menus in API 10?
Thanks, Vamsi
Good news. Google has added action bar in their support library in revision 18.
http://developer.android.com/tools/support-library/index.html
Android doesn't support ActionBar on earlier versions (before honeycomb), but there is a wonderful library you can make use of. Check out ActionBarSherlock. Even inside google guys do encourage developers to use this.
If you want to get HOLO theme for your app that is running on older versions of Android then checkout HoloEverwhere.
What do you mean this by popup menu? then you can do it too.

Categories

Resources