If you want to use the ActionBar design pattern you can do it with the great ActionBarSherlock library from Jake Wharton.
He has done a good job with the library and helps you out with any questions in his google group.
Have a look at his demo app at google play. It shows you most of the features.
ABS (ActionBarSherlock) is an extention to the official support package with the minimum API level of 7 or platform version 2.1.x.
So you need as a requirement at leased the android-support-v4.jar. That means you should have a closer look what this API offers you.
Steps to get you going
- Download the ABS library and unpack it.
- Import the ABS library.
Start Eclipse, Import -> Android -> Existing Android Code Into Workspace
In your Package Explorer you should see a project called ActionBarSherlock
It has the Compiler compliance level 1.6 and in the libs folder you will find the android-support-v4.jar. - Create a test project.
New -> Android Projects
Project Name: TestABS
Build Target: Android 4.0.3
Add the ABS-Library to your project.
Right click on the project -> Properties -> Android -> Library -> Add... -> ActionBarSherlock - Setting the sdk version and the theming.
Edit the AndroidManifest.xml
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="15"/>
<activity ... android:theme="@style/Theme.Sherlock"> - Use the ABS base classes for the Activity
public class TestABSActivity extends SherlockActivity {
Now you can start your AVD with lets say Android version 2.3.3 and you will see the ActionBar with the Holo theme.
The downloaded library package includes the sources for the demo app.
This is a good starting point to explore alle the capabilities of ABS.
515 kB - ABS hello world
APK-Size
38 kB - Standard hello world515 kB - ABS hello world
minimum api level for ABS is 7!
ReplyDeleteThanks mate, I mixed up the java compiler level 1.6 with the Android API level.
Delete