android support v4 v7 v13 V

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.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章