现在的位置: 首页 > 综合 > 正文

android support v4 v7 v13 V

2018年04月30日 ⁄ 综合 ⁄ 共 2083字 ⁄ 字号 评论关闭

Android 版本兼容  向下兼容 

1.6、2.1还是占有一定的市场,故在有些时候,我们还是得要考虑兼容这些版本。

   google提供了Android Support Library package 系列的包来保证来高版本sdk开发的向下兼容性,即我们用4.x开发时,在1.6等版本上,可以使用高版本的有些特性,如fragement,ViewPager等,下面,简单说明下这几个版本间的区别:

Android Support v4 (  1.6 ): 

 这个包是为了照顾1.6及更高版本而设计的,这个包是使用最广泛的,eclipse新建工程时,都默认带有了。

Android Support v7 ( 2.1
):
 

 这个包是为了考虑照顾2.1及以上版本而设计的,但不包含更低,故如果不考虑1.6,我们可以采用再加上这个包,另外注意,v7是要依赖v4这个包的,即,两个得同时被包含。

Android Support v13 (3.2) 
:

这个包的设计是为了android 3.2及更高版本的,一般我们都不常用,平板开发中能用到。

向下兼容(Downward Compatible)

又称向后兼容(Backwards
compatibility),计算机术语。向下兼容常常是相对于向上兼容而言的,两者在兼容的方向性上是相反的,因此这两个概念是不同的。

向下兼容(Downward Compatibility),又称作向后兼容(Backward Compatibility)。在计算机中指在一个程序或者类库更新到较新的版本后,用旧的版本程序创建的文档或系统仍能被正常操作或使用,或在旧版本的类库的基础上开发的程序仍能正常编译运行的情况。例如较高档的计算机或较高版本的软件平台可以运行较为低档计算机或早期的软件平台所开发的程序,如基于Pentium微处理器的PC兼容机可以运行早期在486上运行的全部软件。
向下兼容可以使用户在进行软件或硬件升级时,厂商不必为新设备或新平台从头开始编制应用程序,以前的程序在新的环境中任然有效。 对于软件来说,向下兼容的意思是,较高版本的程序能顺利处理较低版本程序的数据。拿著名的动画制作软件 Flash的两个版本 Flash 5 与 Flash MX 2004 来说,这两个版本虽然保存出来的文件都是 .fla,可是文件内容的结构有所不同。尽管如此,Flash MX 2004 仍然能处理 Flash 5.0 保存的 fla 文件,我们就说 Flash MX 2004 是向下兼容的。

suppport jar 位于 sdk/extras/android/support

Support Libraries for Android.

This SDK component contains static libraries providing access to newer APIs
on older platforms and various helper classes.

To use those libraries, simply copy them as static libraries into your project.

Each library is called v<api>, indicating the minimum API level that they require.

*** V4 ***

v4/android-support-v4.jar contains:
- Fragment API. New in API 11 (3.0 - Honeycomb). http://developer.android.com/reference/android/app/Fragment.html
- Loader API. New in API 11 (3.0 - Honeycomb). http://developer.android.com/reference/android/app/LoaderManager.html
- CursorAdapter / ResourceCursorAdapter / SimpleCursorAdapter. These are the API 11 versions.
- MenuCompat allows calling MenuItem.setShowAsAction which only exists on API 11.

v4/src/ is the source code for the compatibility library
v4/samples/ provides a sample app using the library.

*** V13 ***

v13/android-support-v13.jar provides the same features as v4, plus:
- FragmentPagerAdapter: Implementation of PagerAdapter that represents each page as a Fragment.

v13/src/ is the source code for the compatibility library, not including the v4 source
v13/samples/ provides a sample app using the library.

抱歉!评论已关闭.