I'm new in Android programming. I just wanna how to create a ActionBar for android 2.2 version.
You can use ActionBarSherlock. It's an open source library that emulates the exact features and design of the ActionBar.
Please see: http://actionbarsherlock.com
Google uses this as well in a number of applications.
yes ActionBarSherlock is best option,
Please See https://github.com/JakeWharton/ActionBarSherlock
Use AppCompat library from com.android.support.
Google has released com.android.support to support things like this on older devices
Add the dependecy in build.gradle (it's NOT in the root directory) inside dependencies{...}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
}
And change your theme to Theme.AppCompat or Theme.AppCompat.* (The wildcard represents more styles inside Theme.AppCompat
Related
im trying to use this : https://stackoverflow.com/a/24633486/4707917
but it didnt work for kitkat...
and i need only colorPrimaryDark like Lollipop in kitkat or older sdk.(Without any Library !)
ide:android studio.
any Solution ?
The information provided below is based on this blog post by someone that works for the Android team.
You can do this by using the android support libraries. First add a dependency on the v7 support library to your build.gradle file:
dependencies {
...
compile "com.android.support:appcompat-v7:21.0.+"
}
You can now use the colorPrimaryDark property in your themes.xml file. All you need to do is make sure that your style inherits from an appcompat style, for example: parent="Theme.AppCompat.Light"
Please note that this will only affect the styles of the action bar.
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.
can I use PopupMenu in older API without using support library v7 ?
I am already using support library v4, but it's not enough for this
and what is the alternative, if I don't use it ?
PopupMenu is only available in API 11 or higher. As far as I can tell from the documentation it is not included in any support library and thus cannot be used on a lower api version. You should probably use an alternative like a Dialog or ContextMenu in those situations. It's not the same thing but kind of close.
You must import support v7 in your application same as follow:
Adding libraries with resources
and in your project import android.support.v7.widget.PopupMenu and then compile your code with that your popup menu is compatible for android 2.2 and above.
I have used Appcompat for Actionbar to get actionbar in Android 2.1 devices. I included appcompat library. but it shows Theme.AppCompat.Light not found. please provide suggestions.!
As explained in this thread, you can't just add the jar files, you need to add the full project as a Library dependency. You can find the instructions here.
Try using below Step:
1) File->Import (android-sdk-xxx\extras\android\support\v7). Choose appcompat
2) Project-> properties->Android. In the section library Add and choose appCompat
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