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
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'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
I am creating application which will support Android 2.2 to Android 4.1. The TabHost is deprecated in Android version 3.2. But the created application supported in all the versions. But I want to create the Tab bar application which will look like a tab bar in Android 4.1 while running the application in Android 4.2, If I am running the application in below android 3.2 version device, it must look like the tab bar in that device. How can I do this.?
There are many points to your question,
TabHost is not deprecated yet. Recently Google deprecated TabActivity and ActivityGroup.
Even if it deprecated, it doesn't mean it can't be used. If X is deprecated, it only means a better alternative named Y is there.
Now to answer your question, You have more than one options
You can use ActionBarSherlock as other answers suggests. (EDIT : ActionBarSherlock is now deprecated.)
You can use TabHost with fragments, See my answer here for a
good example. To use Fragment in pre 3.0 API's you need to use
Google's support library.
Try out ActionBarSherlock.
ActionBarSherlock is an extension of the support library designed to facilitate the use of the action bar design pattern across all versions of Android with a single API.
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
Tutorials:
tutorial 1 , tutorial 2 ,
tutorial 3
Just to add, Android has introduced ActionBarCompat to ensure ActionBar is compatible with OS below 3.0 down to 2.1. You can use ActionBarCompat in the support library instead of ActionBarSherlock
http://android-developers.blogspot.co.uk/2013/08/actionbarcompat-and-io-2013-app-source.html
I want to design Action bar UI on pre-honeycomb devices. After my Google i got ActionBarSherlock library. Can i design without using this ActionbarSherlock library. is it possible to design Action bar on pre-honey comb devices by using Android support-v4 library itself?
Basically i trying to design without using third party libraries.
No you can't. Action bar was not included in the support-v4 library. To use action bar on pre-honeycomb devices, you can either use SherlockActionBar, or you can try to develop something to simulate this bar. Something like making a custom view and include this view in all your layout xml files. However, this would be way too much effort to do so. SherlockActionBar is easy to use for me, afterall.
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