In my application i want to create an action bar which as my application icon and a view control. I refered so many tutorials and samples to create action bar but all of them have a plenty of code. I have also read the ActionBarSherlock but this need minsdkversion 15 to compile the libraries. Because i am new in android therefore i need a step by step tutorial to create a simple action bar. If you know a simple and easy tutorial to create action bar using xml then please post your answer.
2 Answers
I've used this library for adding an action bar to 2.2+ apps:
https://github.com/johannilsson/android-actionbar
I found it easy to use and visually appealing, although the style of it does not exactly match the default action bar in ICS.
-
Now my application is installed in the emulator but my app icon doesn't show on my emulator home screen. I followed the example of actionbar given in github.com/johannilsson/android-actionbar and used this example in my application. But in this example there is no activity in the AndroidManifest xml file and one thing also In this example package name is com.markupartist.android.widget.actionbar so i want to know that should i put my all Activity files in that package or not. Commented May 29, 2012 at 12:55
-
and please tell me that what is the use of this line import com.markupartist.android.widget.actionbar.R; In actionbar.java Commented May 29, 2012 at 12:56
-
1@NaveenChauhan I don't believe that apps appear on the home screen by default, have you checked the app launcher? Commented May 29, 2012 at 14:11
-
1@NaveenChauhan the import statement refers to the ActionBar library projects resources, such as drawables and XML layout files. Importing it allows the code to refer to resources easily, e.g.
setContentView(R.layout.myLayout)
Commented May 29, 2012 at 14:14 -
1Yes, it will work with Android 2.3. I think HomeActivity.apk is the one you should install. Commented May 30, 2012 at 20:32
Read this tutorial from Android's official site.
You just need to include android-support-v7-appcompat.jar
support jar in your project from your android-sdk-windows\extras\android\support\v7\appcompat\libs
path on your disk. Then you can use ActionBar below API 11 in Android.
Official Android Tutorial is here: Action Bar Android Official Sherlock bar was creating issues for me then I got this solution.
android:minSdkVersion
can be anything 7 or higher.