Post Reply

[GUIDE][UI] ActionBarShelock

OP Faiz Malkani

12th June 2013, 07:37 PM   |  #1  
Faiz Malkani's Avatar
OP Forum Moderator / XDA Portal Team
Flag Mumbai
Thanks Meter: 1,837
 
7,569 posts
Join Date:Joined: Feb 2012
More
► What?
A simple guide to get the ActionBar on older versions of Android



► Why?
After i released SpecCheck a couple of weeks ago, I got quite a few PMs and quoted posts with users asking me how I managed to get the ActionBar working on pre-Honeycomb devices. The solution is simple : a library by Jake Wharton called ActionBarSherlock. So i decided to write a guide for it



► What you'll need?
➤ An internet connection
➤ Sufficient knowledge of Android programming
➤ Common sense
➤ Google



► How?
In this guide, I will show you how to add ActionBarSherlock to your app. Its quite simple, and has marvelous results.
➤ Step 1:
Download the ActionBarSherlock zip from here

➤ Step 2:
Extract the zip using 7zip or any similar software
Click image for larger version

Name:	screen1.png
Views:	345
Size:	2.5 KB
ID:	2037832

➤ Step 3:
Open the extacted folder and rename the "library" folder to "actionbarsherlock". This is optional, but useful once you import the library into eclipse. It helps distinguish between different libaries.
Click image for larger version

Name:	screen2.png
Views:	480
Size:	18.4 KB
ID:	2037833

➤ Step 4:
Open Eclipse and select File-->Import-->Existing Android code into workspace

➤ Step 5:
Set the root directory to the directory that contains the extracted ActionBarSherlock

➤ Step 6:
You will see multiple options appear below. Deselect all except library (or actionbarsherlock depending on whether you renamed it in Step 3)
Make sure that "Copy projects into workspace" is selected
Click image for larger version

Name:	screen3.png
Views:	508
Size:	26.5 KB
ID:	2037834

➤ Step 7:
Once done, wait for the workspace to build. Then right click on the project you just imported and select Properties

➤ Step 8:
Under the "Android" heading, you can see all platforms and extras you downloaded while setting up the SDK. Ignore that and scroll down. Tick the "isLibrary" option and select OK
Click image for larger version

Name:	screen4.png
Views:	386
Size:	7.3 KB
ID:	2037836

➤ Step 9:
Now right click the project in which you want to implement ActionBarSherlock and select Propeties-->Android. Near the bottom, below the isLibrary option, there is an Add button. Click it and select the actionbarsherlock project.
Click image for larger version

Name:	screen5.png
Views:	387
Size:	7.0 KB
ID:	2037841

➤ Step 10:
Delete the "android-support-v4.jar" from the libs folder in the actionbarshelock project and instead, paste the "android-support-v4.jar" from the libs folder in your application project there

➤ Step 11:
Change your application code to their ActionBarShelock counterparts.
Example, Activity becomes ShelockActivity, Fragment becomes SherlockFragment, getActionBar becomes getSupportActionBar and getMenuInflater becomes getSupportMenuInflater. A simple Google Search can help with this



► Credits
➤ @Chris95X8 : friend and mentor










If you run into any errors or complications, feel free to let me know. I'll be glad to help
__________________________________________________ _________________________________________
Last edited by Faiz Malkani; 12th June 2013 at 07:40 PM.
The Following 13 Users Say Thank You to Faiz Malkani For This Useful Post: [ View ]
12th June 2013, 07:53 PM   |  #2  
Faiz Malkani's Avatar
OP Forum Moderator / XDA Portal Team
Flag Mumbai
Thanks Meter: 1,837
 
7,569 posts
Join Date:Joined: Feb 2012
More
Reserved for ActionBar functions
The Following 2 Users Say Thank You to Faiz Malkani For This Useful Post: [ View ]
12th June 2013, 07:53 PM   |  #3  
Faiz Malkani's Avatar
OP Forum Moderator / XDA Portal Team
Flag Mumbai
Thanks Meter: 1,837
 
7,569 posts
Join Date:Joined: Feb 2012
More
Reserved for ActionBar theming
The Following 2 Users Say Thank You to Faiz Malkani For This Useful Post: [ View ]
13th June 2013, 03:45 PM   |  #4  
SpaceCaker's Avatar
Recognized Themer / Contributor
Flag netherlands
Thanks Meter: 10,774
 
13,350 posts
Join Date:Joined: Mar 2011
More
Can you also create this same guide for the new Android-studio released by android themself ?

i currently use it for layout modding and its pretty nice with a proper GUI
13th June 2013, 04:50 PM   |  #5  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,377
 
2,764 posts
Join Date:Joined: Feb 2013
More
Cool guide!

Google announced their own ActionBar library during the I/O.
Waiting for it.
13th June 2013, 09:04 PM   |  #6  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,377
 
2,764 posts
Join Date:Joined: Feb 2013
More
Congrats! It is featured on the portal.
13th June 2013, 10:32 PM   |  #7  
bassie1995's Avatar
Senior Member
Flag Delft
Thanks Meter: 412
 
2,457 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Quote:
Originally Posted by nikwen

Cool guide!

Google announced their own ActionBar library during the I/O.
Waiting for it.

ActionBarCompat has existed for quite a while, but it's always been quite a bad alternative. ABS has been way better since the beginning.

However, if they improve Compat, it could be something. Like they made their own (simpler) version of the SlidingMenu lib, or its functionality.
14th June 2013, 06:35 PM   |  #8  
pratamawijaya's Avatar
Junior Member
Flag Yogyakarta
Thanks Meter: 2
 
5 posts
Join Date:Joined: Sep 2011
yes.. i think abs is a great lib for android apps

and viewpagerindictor too
14th June 2013, 07:29 PM   |  #9  
bassie1995's Avatar
Senior Member
Flag Delft
Thanks Meter: 412
 
2,457 posts
Join Date:Joined: Jan 2011
Donate to Me
More
Quote:
Originally Posted by pratamawijaya

yes.. i think abs is a great lib for android apps

and viewpagerindictor too

Get your 10 posts by helping, e.g. in your device's Q&A section.

Sent from my GT-I9300 using Tapatalk 4 Beta
15th June 2013, 12:46 PM   |  #10  
nikwen's Avatar
Recognized Contributor
Thanks Meter: 1,377
 
2,764 posts
Join Date:Joined: Feb 2013
More
Quote:
Originally Posted by bassie1995

ActionBarCompat has existed for quite a while, but it's always been quite a bad alternative. ABS has been way better since the beginning.

However, if they improve Compat, it could be something. Like they made their own (simpler) version of the SlidingMenu lib, or its functionality.

If I got it right, it is a completely new library and does not have to do anything with the old one. Did I get it right?

Quote:
Originally Posted by bassie1995

Get your 10 posts by helping, e.g. in your device's Q&A section.

Sent from my GT-I9300 using Tapatalk 4 Beta

Honestly, I do not think that he just wants 10 posts. He has been on the forum for quite a while and his posts are no spam. They are his opinion.

Post Reply Subscribe to Thread

Tags
actionbar, holo, quantumfoam, speccheck, ui design
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes