Support V4,v7

從以前到現在就一直對v4,v7不了解,都直接用...
為何要import這些library?
android v22後又加了appcompact library...更煩..
requires that all activities extend from AppCompatActivity,
還要用toolbar....
只是為了向下相容..
但我都已經設定min api=15...
幹嘛要向下相容api 4 or api 7...這些?
不import,但使用到的library 還是會import...
總之就是很累綴,整個app size就一直變大..

 

When should I use the Android Support Library?

You should use one of the support libraries when you need specific framework features that are newer than the minSdkVersion of your app or that are not available in the standard framework.

comment:簡單講就是如果我不想向下相容,就不需要...現在api 15以上,都>90%...

Support V4 : Backward Compatibility- It includes many features and, as its name suggests, supports back to API 4.

v7-appcompat library :
provides support implementations for ActionBar (introduced in API 11) and Toolbar (introduced in API 21) for releases back to API 7.

ps: import appcompat-v7之後就不需要import Support  v4了,因為v7 default import v4. (這也是我說的就算我不import...還是會被library給自動import..)
如果不想import 整個v7:還有較小的 (其實我都不想import啊...)
  • v7-recyclerview: provides the RecyclerView component, which efficiently displays and animates large amounts of data and is designed to replace ListView
  • v7-cardview: provides the CardView component, enabling the cards UI design pattern
  • v7-gridlayout: provides the GridLayout class, which enables organizing UI elements into a rectangular grid
  • v7-mediarouter: provides MediaRouter and related classes, enabling Google Cast support
  • v7-palette: provides the Palette class, which enables developers to identify primary colors in an image 


AppCompat

AppCompat最開始扮演的是一個不起眼但很重要的角色:讓API 7也能也可以使用actionbar。而在AppCompat 21版本中,AppCompat擔當起了更多的責任:為api 7+的設備帶來material color palette ,widget著色,Toolbar以及其他功能。因此ActionBarActivity這個名稱已經不能完整的體現AppCompat的作用了。在這個版本中,ActionBarActivity已經不推薦,取而代之的新寵是AppCompatActivity.

ps: 就是讓api 21以前的沒有material design的加入一點點material design的元素...顏色等等...但不一定100%能展現material design, 因為material design是 api 22之後才有的,但使用起來要隱藏原有的actionbar改用toolbar...很麻煩...menu icon也常常被隱藏...原生的被隱藏起來,不好用


別以為這樣就沒了,還有...Design Support Library

The Design package provides APIs to support adding material design components and patterns to your apps.

The Design Support library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs.

The Gradle build script dependency identifier for this library is as follows: com.android.support:design:24.2.1

所以android真的異常肥大...

另外:
Google considers use of the support libraries a best practice, even if not necessarily required. It includes v7-appcompat and v4 libraries in most of its sample code as well as in Android Studio’s new project templates. Google is clearly investing significant effort in these compatibility libraries and expects developers to heavily rely upon them.

留言

這個網誌中的熱門文章

最爛的銀行服務-玉山銀行

Mark App Design Apps - Terms and Privacy Policy (服務條款,隱私權政策)

SMR疊瓦式hdd致命缺陷被解決????!!!

ios app 上架時app icon要注意事項

更改google drive預設存放目錄位置Change Google Drive Default Folder Location in Windows

舊有app在Android 12 閃退問題& app Splash screens

google play 正式發布前測試報告...非常好用.

app bundle and bundletool. 關於aab安裝問題

關於google play console app應用程式簽署

Google Play badge徽章產生器