Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,742,742 Members 37,513 Now Online
XDA Developers Android and Mobile Development Forum

[GUIDE][UI] ActionBarShelock

Tip us?
 
Faiz Malkani
Old
(Last edited by Faiz Malkani; 12th June 2013 at 07:40 PM.)
#1  
Faiz Malkani's Avatar
Forum Moderator / XDA Portal Team - OP
Thanks Meter 1811
Posts: 7,528
Join Date: Feb 2012
Location: Mumbai
Default [GUIDE][UI] ActionBarShelock

► 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:	339
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:	473
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:	500
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:	379
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:	380
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
__________________________________________________ _________________________________________
The Following 12 Users Say Thank You to Faiz Malkani For This Useful Post: [ Click to Expand ]
 
Faiz Malkani
Old
#2  
Faiz Malkani's Avatar
Forum Moderator / XDA Portal Team - OP
Thanks Meter 1811
Posts: 7,528
Join Date: Feb 2012
Location: Mumbai
Reserved for ActionBar functions
The Following 2 Users Say Thank You to Faiz Malkani For This Useful Post: [ Click to Expand ]
 
Faiz Malkani
Old
#3  
Faiz Malkani's Avatar
Forum Moderator / XDA Portal Team - OP
Thanks Meter 1811
Posts: 7,528
Join Date: Feb 2012
Location: Mumbai
Reserved for ActionBar theming
The Following 2 Users Say Thank You to Faiz Malkani For This Useful Post: [ Click to Expand ]
 
SpaceCaker
Old
#4  
SpaceCaker's Avatar
Recognized Themer / Contributor
Thanks Meter 10509
Posts: 13,133
Join Date: Mar 2011
Location: netherlands
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
 

My Github Click Here
Github BroadcomCM Click Here
Github CyanoSpaceMod Click Here
Github MSR-Roms Click Here
Check My SoundCloud for my music remakes,mixes etc Click Here
Linux HP-Pavilion-G7 3.11.0-23-generic #40-Ubuntu SMP Wed Jun 4 21:05:23 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
 
bassie1995
Old
#7  
bassie1995's Avatar
Senior Member
Thanks Meter 409
Posts: 2,438
Join Date: Jan 2011
Location: Delft

 
DONATE TO ME
Quote:
Originally Posted by nikwen View Post
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.
 
pratamawijaya
Old
#8  
pratamawijaya's Avatar
Junior Member
Thanks Meter 2
Posts: 4
Join Date: Sep 2011
Location: Yogyakarta
yes.. i think abs is a great lib for android apps

and viewpagerindictor too
 
bassie1995
Old
#9  
bassie1995's Avatar
Senior Member
Thanks Meter 409
Posts: 2,438
Join Date: Jan 2011
Location: Delft

 
DONATE TO ME
Quote:
Originally Posted by pratamawijaya View Post
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
 
nikwen
Old
#10  
nikwen's Avatar
Recognized Contributor
Thanks Meter 1298
Posts: 2,690
Join Date: Feb 2013
Quote:
Originally Posted by bassie1995 View Post
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 View Post
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.

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

Advanced Search
Display Modes