Action bar not show good in android lower than 4 - android

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.

Related

I don't have a separate folder called values v21

I am using android studio 1.0
Trying to make material design app that is compatible with older versions of android too...
Made new blank project, Added compile 'com.android.support:appcompat-v7:21.0.3' dependency to the gradle file
Still no luck :/
Anyone please help me out....
Create the values-v21 folder and create styles.xml
Inside styles.xml choose Material Theme.
It was in older versions of Android Sudio. In Android Studio 1.0 you have to create by yourself.
Check your SDK version update it to Android 5.0 (Api 21).
And you will be good to go.
Maintain material design Compatibility to older version of Android by following this link.
https://developer.android.com/training/material/compatibility.html
Cheers..
If you want to make a material design app that is compatible with older versions of Android, you really need to include the library
'com.android.support:appcompat-v7:21.+'
And make some changes to your app. This link shows a pretty good how to
http://android-developers.blogspot.com.br/2014/10/appcompat-v21-material-design-for-pre.html
The most importante change is the new Toolbar, that you can eather include in every layout you want, or work with "ActioBarActivities". Again, reading this official blog post will help you.
But, as the title of your question said, you can create a folder called "values-21" and put a new "style.xml", that will target only Android Lollipop. In this file, you can extend android:Theme.Material and use some features that are only present in Android 5.0, like ripples and some animations.

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

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

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

How to "install" Action Bar Sherlock?

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!

Categories

Resources