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.
Related
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
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i am newbie in Android and in this forum too. i don't know when to use Action bar and sherlockActionbar. i am using Api 16 . Can someone please explain here? Thanks in advance.
Updated :please tell me how to customize my Action bar. i don't wanna show my app icon in left side of action bar and also want s to change the color and put the image over there??
Action bar is build for API Level 11 or higher so that will not run below that API version.
Note:
This class is included in the support library for compatibility with API level 7 and higher. If you're developing your app for API level 11 and higher only, you should instead use the framework ActionBar class.
ActionBar Support Lib / ActionBarCompat That has released by Google for older version also.
We released a new backward-compatible Action Bar implementation called ActionBarCompat that's part of the Support Library r18. The ActionBarCompat APIs let you build the essential Action Bar design pattern into your app, with broad compatibility back to Android 2.1.
ActionbarSherlock is library project which support in lower version. Minimum API level is 7
In your case,
If your android:minSDK="16" then you should go with ActionBar. but ,
If you want to set your android:minSDK="10" or below then that , in that case you should use ActionbarSherlock.
For sherlockActionbar, you should build your application with SDK version 14 or above.
Due to its use of the native action bar and its related classes on Ice
Cream Sandwich, the library requires that both it and your project are
compiled with Android 4.0 or newer. The project also requires that you
are compiling with JDK 1.6 in both your editor and any build systems
that you may be using.
And if you check out the support library at:
http://developer.android.com/tools/support-library/index.html
If you are using Support Library v7 or above:
New v7 appcompat library:
Added ActionBar to allow implementation of the action bar user interface design pattern back to Android 2.1 (API level 7) and higher. Use of this class requires that you implement your activity by extending the new ActionBarActivity class.
It is built in with Action Bar and you can use it safely without externally including SherlockActionBar.
Note: v7 appcompat library depends on the v4 Support Library. If you are using
Ant or Eclipse, make sure you include the v4 Support Library as part
of this library's classpath.
Of course you have to use Sherlock if you are still using v4 support library solely.
Answer for your updated question:
If you want to remove app icon from action bar then just remove this line from Manifest file in application tag
android:icon="#drawable/app_icon"
If you wanna change that image just put one image in drawable folder and replace app_icon with that image name which is present in the drawable folder
android:icon="#drawable/your_image_name"
To change color refer this link
This question already has answers here:
What is the equivalent of ActionBar in earlier sdk versions? [closed]
(4 answers)
Closed 9 years ago.
I'm currently trying to create an ActionBar for my Android application. But I need it to work in Android 2.2 and 2.3 too. Is there any way to implement ActionBar in Android 2.3/2.2?
Have a look at ActionBarSherlock. Just add the library to your Android project and overwrite Activity with SherlockActivity, so you have all the possibilities of an Actionbar.
ActionbarSherlock is a library that makes almost all features of the ActionBar available on Android 2.1 and up. When you use a API Level that supports the action bar natively it will automatically use the native action bar instead.
You can use the actionbar with ActionBarSherlock. It is simple to install and can do everything you need. For the beginning you can start here to read.
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 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