Support Compatibility package in the Android SDK _android

Source: Internet
Author: User

Background

A question from the AppCompat and Holo in Android that comes from an answer to an invitation? , it seems that a lot of people are still confused about these compatibility packs, so simply write a blog.

Support Library

We all know that some of the Android SDK is split, so Google officially provides the Android Support Library package package to ensure the compatibility of the High version SDK development, so you may often see v4,v7,v13 these numbers, Let's begin by understanding the meaning of these numbers and the differences between them.

Support-v4

Use the API Lever 4 (that is, Android 1.6) or later. It contains relatively more content and is used more widely, for example: Fragment,notificationcompat,loadbroadcastmanager,viewpager,pagetabstrip,loader, Fileprovider, etc.

Gradle Reference Method:

Copy Code code as follows:

Compile ' com.android.support:support-v4:21.0.3 '

Support-v7

This package is designed to take account of API Level 7 (that is, Android 2.1) and above, but V7 is dependent on the V4 package, V7 supports action bar and some theme compatibility.

Gradle Reference Method:

Copy Code code as follows:

Compile ' com.android.support:appcompat-v7:21.0.3 '

Support-v13
This package is designed for API level 13 (that is, Android 3.2) and a higher version, generally we are not commonly used, flat-panel development can be used, here is not too much introduction.

Theme
Back to the subject of knowledge, let's introduce the concepts of various theme.

Hoho Theme

Android can be said to have no design prior to 4.0, after 4.0 launched the Android design, since the Android has been greatly improved, and in the program implementation of the corresponding is Holo style, so you see a similar Theme.Holo.Light, Theme.Holo.Light.DarkActionBar is 4.0 design style, but in order to let 4.0 before the version can have this style how to do? This time will have to quote V7 package, so corresponding to have Theme.AppCompat.Light, Theme.AppCompat.Light.DarkActionBar, if your program has a minimum support version of 4.0, then you may not need to consider v7 compatibility.

Material Design Theme

The 5.0 version of this year, Android launched the concept of material design, which is a major breakthrough in Android. The corresponding program implementation on the Theme.Material.Light, Theme.Material.Light.DarkActionBar, etc., but this style can only be applied to the 5.0 version of the mobile phone, if the 5.0 before the application of the Material What should I do with the design? The same reference APPCOMPAT-V7 package, this time the Theme.AppCompat.Light, Theme.AppCompat.Light.DarkActionBar is relatively compatible with the material design Theme.

Attention matters

Gradle Reference APPCOMPAT-V7 Package when you do not need to cite the V4, because the V7 contains the default V4 package;

The 21 in compile ' com.android.support:appcompat-v7:21.0.3 ' represents the Compatibility Pack that API level 21 launches, so if you're referring to a version prior to 21, The default Theme.AppCompat.Light is Holo style, and the version starting from 21 defaults to material style.

After using AppCompat, all your activity should inherit from Actionbaractivity, and actionbaractivity inherit from fragmentactivity, so use fragment with ease;

Finally, I believe that has been said very clearly, we have questions can be directly blog message. If the English is good, can directly to the official most authoritative explanation https://developer.android.com/tools/support-library/features.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.