How to "install" Action Bar Sherlock? - android

I'm trying to build the sample project "Action Bar Styled" using the Action Bar Sherlock.
I download the .zip file containing ABS here http://actionbarsherlock.com/ but I can't figure out where to unzip so that it will appear on Project>Properties>Add library.
Can someone give me an hand?
Also, I read somewhere (can't find it now, sorry) that the current Android Compatibility library supports the Action Bar in pre 3.0 versions, so it has basically the same "effect" as Action Bar Sherlock - can someone confirm this? Which library should I install?

Didn't heard about Compatibility library that contains action bars, I've downloaded the last one few days ago.
Anyway, it's very simple, unzip the file IN(!!) your workspace, then create new android project, and choose "Create project from existing source", then choose the "library" folder in the folders you've just unzipped.
Right click on the action bar sherlock project, properties > android > check "Is Library".
Then right click on your project, properties > android > change the target SDK to 3.2 (API 13), and press add library and choose the sherlock library.
You change your project to 3.2 so the sherlock can work, but you can still use it down to 1.6, just write in your manifest this line:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="13" />
And be careful not to use API 13 code in your app.
I wrote this really fast so if you don't understand me feel free to ask, and if you still don't understand you can look at their web in FAQ there's a video that explains how to use it, step by step.
Good luck!

Related

Adding sherlock action bar

I want to implement action bar in my android application. I have searched for that and I found out the I need to add some libraries in order to able to use action bar for android 2.X. I started following some online tutorials about adding sherlock actionbar. In every tutorial its mentioned that when I extract the library file which I downloaded from :here
I should get three folders samples, library, and website. But I didn't get them.
So I couldn't follow the rest of the tutorial. Here is the list of the files and folders I have got after extracting the folder :
actionbarsherlock build.gradle deploy_website.sh RELEASING.md
actionbarsherlock-fest CHANGELOG.md LICENSE.txt settings.gradle
actionbarsherlock-i18n checkstyle.xml pom.xml website
actionbarsherlock-samples CONTRIBUTING.md README.md
I'm using Linux mint and eclipse. Can anyone tell me how to add the sherlock library?
Why do you need to use actionbarsherlock ? Support for the action bar is added now in support library.
"From your activity, you can retrieve an instance of ActionBar by calling getSupportActionBar()."
see the link below for more info.
http://developer.android.com/tools/support-library/index.html
http://developer.android.com/reference/android/support/v7/app/ActionBar.html
Why don't you use use ActionBar Compat?
It's available in the support library v7, allows minSdk 7 and it's a library from Google.
Furthermore the development of ActionBarSherlock is stopped
1.First you need to import sherlock lib project to eclipse.
2.Now add this library project to your sample project(Right click on project ->Properties--->Android-->add library)
NOTE: your sample project path and library project path shall be same.
3.Now create a Sherlock Activity instead of simple activity by extending SherlockActivity class .
4.You also need to change theme also.
https://github.com/jfeinstein10/SlidingMenu is a good example for Sherlock download as zip and import it to you workspace i hope it help you

Action bar not show good in android lower than 4

My Action Bar is not showing properly.
I used support library appcompact v7. Application is running well but
when I run it on Android lower version as 4 then
is my Action Bar outspread to full screen so it overlay of the
main view.
Do you have some suggestions to solve this problem?
Thanks
Illustrative pictures:
on Android 4
older versions
The Action bar doesn't show in devices running older versions of android. It doesn't matter that you are using the compatibility lib.
If you want the action bar on older android devices , I would recommend Action Bar Sherlock . Here is the link to it http://actionbarsherlock.com
Also I didn't quite follow you last sentence , are you saying that the action bar is expanding to full screen in older devices? That is very unusual , can you post your code pls.
ActionBarCompat is not supported in API level 4. It is only supported from API level 7. Have a look: http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html
Finally, after a couple of days I found a solution to this problem.
First, I had the following lines in my build.gradle file:
compile 'com.android.support:appcompat-v7:18.0.+'
compile 'com.android.support:support-v4:18.0.+'
This is okay, but I had also inserted this line
compile fileTree('libs')
in the gradle file to add adMob library to my application, and this caused the problem.
In the libs folder of my project, I had also added 'android-support-v7-appcompat.jar'. Action Bar used this first, without the dependencies that are contained in res folder of the appcompat library.
I deleted 'android-support-v7-appcompat.jar' from libs folder of my application project and my application is now fully functional on Android API 7-18 without using third party solutions, such as Sherlock.

android 2.3.3 api 10 action bar

I'm using android 2.3.3(on eclipse), I would like to add action bar to my project.
I've tried to add android support library V7 and got many errors like this:
[2013-08-12 16:42:36 - app name_1_1_1] C:\Program
Files\Android\android-sdk\extras\android\support\v7\appcompat\res\values-v14\styles_base.xml:24:
error: Error retrieving parent for item: No resource found that
matches the given name 'android:Widget.Holo.ActionBar'.
Is it possible to add the support library or add different library for the action bar ?
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.
This may help you
Android actionbar how to add supporting library v7 appcompat for Eclipse
or try this one
There are two ways to go to do ActionBar for Android 2.3.3/API Level 10,
You can use ActionBarCombat which is the support library version
of Android; here is a detailed official tutorial
http://android-developers.blogspot.com/2013/08/actionbarcompat-and-io-2013-app-source.html
You can use 3rd party library which is ActionBarSherlock, also the
usage is here http://actionbarsherlock.com/usage.html
Try Action Bar Sherlock. From their website:
The library will automatically use the native action bar when appropriate or will automatically wrap a custom implementation around your layouts. This allows you to easily develop an application with an action bar for every version of Android from 2.x and up.
its because you set project build target below 4.0
try to change ur build target above 4.0
and don;'t worry,, it can run on 2.3.3 too

No resource identifier found for attribute 'showAsAction' in package

Now I know that this question has been asked many times but the solution that has always been proposed has not worked for me. It has been said that the minimum SDK version has to be greater than 10 in order for showAsAction to be used. In my manifest file, I have set my minimum sdk at 17 and my target sdk at 17. What else could be causing this error? Here is my menu's XML file:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:Text2Morse="http://schemas.android.com/apk/res-auto">
<item
android:id="#+id/SettingsID"
Text2Morse:showAsAction="ifroom"
android:icon="#drawable/ic_gearl"
android:title="#string/MySetting">
</item>
<item
android:id="#+id/ReadMeID"
android:icon="#drawable/ic_readmel"
android:title="#string/Read_me">
</item>
Could it be that the support library is not properly included on the build path? To include the support library on the build path I was following the steps posted on the android development website:Support Library SetUp
I got through the first part alright but when I get down part that says "Add the library to your application project" things don't work.
Directions
For example, on step 2 for this portion of the directions it says "In the Library pane, click Add". I do not know what program they are using but I am using eclipse. There is no add button in the Library tab for me. There is only add jars, add external jars, add variable, add library, add class folder, add external class folder. There is an add button in the Projects tab but this is not the Library tab. I have even experimented by assuming that the directions really mean to refer to the project tab and following the steps from there. I add the Support Library project folder but I still see the same error.
All I want is for some of my menu items to show up on the action bar. Can someone help me out here?
I spent forever trying to make this work in the XML, and never could. I suspect a problem with build path and the support libraries.
I was able to make this work by setting the flag in Java instead:
menu.add(0, MENU_FULLSCREEN, 0, "Fullscreen").setIcon(R.drawable.ic_action_fullscreen).setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

Action bar implementation with ActionbarSherlock

I am using ActionBarSherlock to implement action bar on my Android 2.1 API 7 project. (With Eclipse IDE)
In order to use sherlock, after I imported sherlock library as a existing project on Eclipse. I did the following things on my own project:
mouse right click on my project, choose "properties"
in "Android" section, there is "Library" sub-section, I added sherlock project as library
Apply change
Then, I notice the FragmentActivity can not be resolved in my project source code.
I checked the project property again, the added sherlock project as library is not in "Library" section...weired!!! Why it suddenly disappeared even I have added sherlock as library? What am I missing?
I mean no matter how many times I added sherlock as library to my own project, the next time I check project property, the sherlock just disappear from library section...
First, after adding the project as a library, restart Eclipse - I believe this is a known bug with at least some versions of the plugin.
If that doesn't work, check that the 'default.properties' file in your project root is not read only.
Other known problems :
Your app should use the same "Uses-sdk" setting in AndroidManifest like your Sherlock addon
Minimum Java version for Sherlock: 1.6 !
In package with libraries, you also have a lot of samples with source code
ActionBar is not visible in Layouts
Few simple that i remember

Categories

Resources