[GUIDE][UI] ActionBarShelock

Search This thread

Faiz Malkani

XDA Portal Team / Retired Forum Moderator
Feb 27, 2012
7,606
1,788
Mumbai
faizmalkani.com
► 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
screen1.png

➤ 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.
screen2.png

➤ 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
screen3.png

➤ 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
screen4.png

➤ 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.
screen5.png

➤ 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:

nikwen

Senior Member
Feb 1, 2013
3,142
1,597
Berlin, Germany
www.nikwen.de
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?

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. ;)
 

bassie1995

Senior Member
Jan 9, 2011
2,505
407
Delft
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?

How do you mean? ABC and ABS are completely separate, yes.

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. ;)

True, but it doesn't change the fact that it was put in place so people post useful contributions and try to help people. Not hating, just saying :p.
 

PineappleOwl

Senior Member
Mar 22, 2013
525
968
I cant comprehense step 10 sir. Should I delete the android. . . jar in actionbarsherlock/libs? or I will paste it at the MYPROJECT/libs to replace the android. . . .jar?
 

Faiz Malkani

XDA Portal Team / Retired Forum Moderator
Feb 27, 2012
7,606
1,788
Mumbai
faizmalkani.com
  • Like
Reactions: out of ideas

Top Liked Posts

  • There are no posts matching your filters.
  • 13
    ► 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
    screen1.png

    ➤ 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.
    screen2.png

    ➤ 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
    screen3.png

    ➤ 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
    screen4.png

    ➤ 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.
    screen5.png

    ➤ 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
    ___________________________________________________________________________________________
    2
    Reserved for ActionBar functions
    2
    Reserved for ActionBar theming
    2
    Definitely include this in the theming post. Simple style generator by Jeff Gilfelt

    http://jgilfelt.github.io/android-actionbarstylegenerator/

    found it in androguide.fr's thread a little while ago.

    Saves a TON of time with color schemes and what not. Only wish it had translucent colored title bars.
    1
    I cant comprehense step 10 sir. Should I delete the android. . . jar in actionbarsherlock/libs? or I will paste it at the MYPROJECT/libs to replace the android. . . .jar?

    Deleted the jar in actionbarsherlock/libs
    Then copy the one from MYPROJECT/libs to actionbarsherlock/libs



    Sent from my Nexus 4