When to use support library

前端 未结 4 513
失恋的感觉
失恋的感觉 2021-02-07 10:38

I am confused on the purpose of the Android support library and when it is needed. It is my understanding that the major plus of using the support library is for Android to impl

4条回答
  •  情书的邮戳
    2021-02-07 10:48

    I find a good article at http://martiancraft.com/blog/2015/06/android-support-library/

    It mentions:

    Furthermore, in some cases, developers may think they have the choice between framework and support implementations of a particular feature, only to find out that support dependencies dictate that decision for them. For example, the v7-appcompat library enables developers to use Material Design UI features introduced in API 21. However, doing so requires that all activities extend from AppCompatActivity, which extends from the v4 support FragmentActivity. So, developers targeting anything less than API 21 and wishing to use Material Design UI features are forced to use v4 support Fragments, rather than framework Fragments.

    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.

提交回复
热议问题