I am building an app and i want to use material theme in my app with api level 14 can anyone help me out. I tried it but it was wit api level 21. I want it with api level 14.
v7 Support Libraries - There are several libraries designed to be used with Android 2.1 (API level 7) and higher. These libraries provide specific feature sets and can be included in your application independently from each other
you have to use v7 appcompat library - This library adds support for the Action Bar user interface design pattern. This library includes support for material design user interface implementations.
Related
I see some examples use
compile 'com.android.support:appcompat-v7:21.0.3'
and some show:
compile 'com.android.support:support-v7:21.0.3'
What is the difference between these two libraries?
v4 support library
This library is designed to be used with Android 1.6 (API level 4) and higher. It includes the largest set of APIs compared to the other libraries, including support for application components, user interface features, accessibility, data handling, network connectivity, and programming utilities.
v7 appcompat library
This library adds support for the Action Bar user interface design pattern. This library includes support for material design user interface implementations.
Note: This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part of this library's classpath.
Source: https://developer.android.com/tools/support-library/features.html
AppCompat (At first ActionBarCompat) started out as a backport of the Android 4.0 ActionBar API for devices running on Gingerbread, providing a common API layer on top of the backported implementation and the framework implementation. AppCompat v21+ delivers an API and feature-set that is up-to-date with Android 5.0 like some material styles and themes as well as some Android 5 components like cardview and palette library.
As you can see AppCompat is mostly about making new android app design concept available in older versions.
Support Library on the other hand tries to provide functionalities of new version of android in older versions like fragments. It also has some useful classes which are not present in any version of android like ViewPager, LruCache and LocalBroadcastManager.
We have an existing Android app that supports API Level 8 up to 18. We used compatibility libraries 19.1.0. Now we are changing/upgrading to:
Minimum SDK = 14
Target = android-22
Now given that there are v4, v7, v13 support, compatibility, and appcompat libraries in different versions, I'm not sure which ones to include and which ones not.
We are using maven for dependency management and using Maven SDK deployer
Android Support Library v4, v7, v8, v13 and v17 are totally different libraries. v7 is not the newer version of v4 and v8 is not the newer version of v7. You can't find a component provided by v7 in v4 and with the same reason, you can't find a component provided by v8 in v7.
The number of each v indicate the minimum Android version that library provided inside can be backward compatible. For example, if you use a v8 component. You application will be able to run on a phone with API Level 8 and above. If you need to use a component from both v7 and v8, you have to include BOTH of them to your project.
Since your minSdkVersion is now 14, you are safe to use any of v4, v7, v8 and v13.
Please note that the latest version of Android Support Library is now 22.0.0. I suggest you to move from 19.1.0 to 22.0.0. It is far better.
If you are using a minSDK of 14 then technically you do not need any of them. However, here are things to think about:
Support v4 (com.android.support:support-v4:23.0.0)
App Components Fragment - Adds support for encapsulation of user
interface and functionality with Fragments, enabling applications to
provide layouts that adjust between small and large-screen devices.
NotificationCompat - Adds support for rich notification features.
LocalBroadcastManager - Allows applications to easily register for and
receive intents within a single application without broadcasting them
globally.
User Interface ViewPager - Adds a ViewGroup that manages the
layout for the child views, which the user can swipe between.
PagerTitleStrip - Adds a non-interactive title strip, that can be
added as a child of ViewPager.
PagerTabStrip - Adds a navigation widget for switching between paged views, that can also be used with ViewPager.
App Compat v7 (com.android.support:appcompat-v7:23.0.0)
Here are a few of the key classes included in the v7 appcompat
library
ActionBar - Provides an implementation of the action bar user
interface pattern. For more information on using the Action Bar, see
the Action Bar developer guide.
ActionBarActivity - Adds an application activity class that must be used as a base class for activities that uses the Support Library action bar implementation.
ShareActionProvider - Adds support for a standardized sharing action
(such as email or posting to social applications) that can be in an action bar.
Support v13 (com.android.support:support-v13:23.0.0)
This library is designed to be used for Android 3.2 (API level 13) and
higher. It adds support for the Fragment user interface pattern with
the (FragmentCompat) class and additional fragment support classes.
For more information about fragments, see the Fragments developer
guide. For detailed information about the v13 Support Library APIs,
see the android.support.v13 package in the API reference.
See their revisions here: http://developer.android.com/tools/support-library/index.html
See all of the libraries listed here: http://developer.android.com/tools/support-library/features.html
I want to use ActionBar.setHomeAsUpIndicator(drawable), but it's only available from api 18 onwards:
http://developer.android.com/reference/android/app/ActionBar.html#setHomeAsUpIndicator(android.graphics.drawable.Drawable)
It seems available in the compatibility library from v7 onwards?:
http://developer.android.com/reference/android/support/v7/app/ActionBar.html#setHomeAsUpIndicator(android.graphics.drawable.Drawable)
I'm not using any of the compatibility libraries, though, since I was targeting only api 14 and higher. Reading this article I thought that was ok to do:
http://developer.android.com/training/basics/actionbar/setting-up.html
So now do I have to restructure everything to use the compatibility library and have all my activities extend from ActionBarActivity? Please let it be no.
Thanks
While the main reason to use the compatibility library is to run on pre-11 versions, there are always new features added and the compatibility library also addresses those differences. For example, there's a bunch of features that were added in 14 but not in 11, the compatibility library backports those to 11 as well as 7.
Since this feature is v18+ only, if you want to use it, you have to use the compatibility library. Or just drop the feature.
I have created a new android project in Eclipse, and I have setted this configuration:
Minimum required SDK: API 7
Target SDK: API 18
Compile with: API 18
Theme: Holo Light
So, my application has the actionbar. Eclipse has automatically included only android-support-v4.jar.
But, since ActionBar class is included in the support library for compatibility with API level 7 and higher. I am wondering why in my project are included only android-support-v4 library.
I guess that if I don't include v7 appcompat library I can continue to show the actionbar in my application, but I can't manage or customize it using ActionBar API? Is this right?
Quoting from the docs
The ActionBar APIs were first added in Android 3.0 (API level 11) but they are also available in the Support Library for compatibility with Android 2.1 (API level 7) and above.
http://developer.android.com/guide/topics/ui/actionbar.html
If you want your app to support action bar below 3.0 you need to use app compact v7 from the support library.
Also check the below link
http://android-developers.blogspot.in/2013/08/actionbarcompat-and-io-2013-app-source.html
you need to understand some of the very basic things.
1) Support libraries are meant to support functionalities in previous versions. you need to manually setup your project(addition in build path etc) to use support libraries.
2) If you dont use support library v7 in this case, You can show action bar, can customize it and do whatever it is supported in the version(3.0) ActionBar supported in.
3) If you want to show Action Bar in suppose Api levels 8/7(2.2/2.1), you must use support libraries v7.
Here is how to create action bars and support it lower versions
Please dont forget to use/imports classes/apis from support library instead of SDKs classes.
Tutorial is easy enough to understand.
1) Support libraries are meant to support functionalities in previous versions and add functionalities that only exists in these libraries. You need to manually setup your project(addition in build path etc) to use support libraries.
I wanted to know the difference between android-support-v4.jar
and android-support-v7-appcompat.jar. If I want to add appcompat Action Bar in my application do I need to add both android-support-v7-appcompat.jar and android-support-v4.jar or only android-support-v7-appcompat.jar.
Also, does android-support-v13.jar has appcompat?
UPDATE
There are many changes done into support library since this question was answered. Good thing is, it is very well documented also. So you must read Support Library Documentation for more details and more available support library.
Starting with Support Library release 26.0.0 (July 2017), the minimum
supported API level across most support libraries has increased to
Android 4.0 (API level 14) for most library packages.
Below is difference from Support Library Packages:
v4 Support Library
This library is designed to be used with Android 1.6 (API level 4) Android 2.3 (API level 9) Android 4.0 (API level 14) and higher. It includes the largest set of APIs compared to the other
libraries, including support for application components, user
interface features, accessibility, data handling, network
connectivity, and programming utilities.
v7 Libraries
There are several libraries designed to be used with Android 2.1 (API level 7) Android 2.3 (API level 9) Android 4.0 (API level 14) and higher. These libraries provide specific feature sets and
can be included in your application independently from each other.
v7 appcompat library
This library adds support for the Action Bar user interface design pattern.
Note:
This library depends on the v4 Support Library. If you are using Ant or Eclipse, make sure you include the v4 Support Library as part
of this library's classpath.
So yes you need both jars if you want to use v7.
Update for android-support-v13.jar
v13 Support Library
This interface was deprecated in API level 27.1.0. Use Fragment instead of the framework Fragment.
v13 Support Library
This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern
with the (FragmentCompat) class and additional fragment support
classes
When you see the package details it has a class FragmentCompat as given in definition. So it has not the all classes of appcompat library.
What is a support library?
Support libraries are code libraries(Collection of classes) which makes a newly added feature to work with the older devices.
For example, Material Design was introduced in API 21 (Android 5.0 - Lolipop) but
the v7-support library makes it available for API 7 (Android 2.1.x -Eclair) and higher.
What are different support libraries?
Some of the main support libraries are
V4 Support library
V7 Support library
V8 Support library
v13 Support library
What does 7 stand for in v7 Support Library?
It means this library has features designed to be used with API level 7 and higher. Same goes with V4 (contains features meant for API 4 and higher) and so on.
Difference between v7 Support library and v7 appcompat library?
Few people including me get confused with these two terms. Actually, v7 appcompat library is a part of v7 Support library. v7 support library was mainly developed to support Material design and ActionBar design pattern for API 7 and higher.
V7 can be categorized into more sub categories
v7 appcompat library
v7 cardView library
v7 recyclerView library
v7 pallete library etc
v7 appcompat library has following key classes ActionBar, ActionBarActivity, ShareActionProvider.
So adding,
com.android.support:appcompat-v7:21.0.+
dependency in your gradle file, imports the above-mentioned classes.
Bonus
Other support libraries
Multidex Support Library (For creating apps with more than 65k methods)
v17 Leanback support Library (A Support library which provides important widgets for Android TV)
Relevant links
Support Library Features
Support Library Packages
Support Library Features Guide
What is Multidex and what is the use of Multidex Support Library?
Support library only required if your minimum sdk version is less than API Level 11. otherwise you do not need to add support library to your project for Api Level 11 or Greater.
android-support-v4.jar: Support android.app classes to assist with development of applications for android API level 4 or later. So that you will able to make your application backword compatible,
android-support-v7.jar It is recently added in latest support library updation. ActionBar to allow implementation of the action bar user interface design pattern back to Android 2.1 (API level 7) and higher. Use of this class requires that you implement your activity by extending the new ActionBarActivity class.
If I want to add appcompat action bar in my application do I need to
add both android-support-v7-appcompat.jar and android-support-v4.jar
or only android-support-v7-appcompat.jar.
Yes you need to add reference of both libraries if you want to use it.
does android-support-v13.jar has appcompat?
No, It includes FragmentCompat so that if some of the Fragment feature add added after version 13 than you can make it backword compatible to Api level 11. so that Application targeting API 11 or greater can use feature which added on newer versions.
This answer is relevant for clients of support libraries which their version is >= 26.0.0:
Caution: Starting with Support Library release 26.0.0 (July 2017), the minimum supported API level across most support libraries has increased to Android 4.0 (API level 14) for most library packages.
For example, the support-v4 and the support-v7 package both support a minimum API level of 14, for releases of the Support Library from 26.0.0 and higher.
For more information, see Support Library - Version Support and Package Names.