I'm new here, so bear with me! I'm sorta confused about the new Design Support Library (and how one implements support libraries), and I had a two questions:
- I'm confused about how support libraries are implemented. Is it something as simple as saying 'if the OS version is below version 5.0, use the V7 support library', or would I have to code an 'Alternative Layout'(One for devices running +5.0, and one for devices running older version of android?)
- Does the Design Support Library replace or add-to the V7 support libraries? (If I wanted to include, say, cards and a snack bar in an app, would I be able to just use the Design Support Library or would I have to use it along with the v7 cardview library? I know it's a stupid question, but I just want to make sure.)
Thanks a lot!
The libraries takes care for you of compatibility for pre-Lollipop (and pre-M) devices for the views contained in it.
Add-to. The design support library contains some views exclusive for helping to achieve a perfect "materialized" app. For RecyclerView, CardView, Palette etc, you must use their separate support libraries. E.g.:
You can use the support libraries to backport some features introduced with the last api (for example 21) to old devices running a previous api level.
For example, API21 introduced a new widget, the Toolbar. This widget can be used only in device with API >=21.
With the
appcompat
rel.21 (a v7 Support library) you can use the Toolbar (pay attention to the package) to implement your Toolbar in old devices running API>=7.This can happen because the support libraries are included in your apk.
The Design Support Library is a new library which add new features. It contains views as Snackbar, TextInputLayout, FloatingActionButton, but it doesn't contain the Card.
So use this dependency for the design support library:
This dependency to use the AppCompat library
This dependency for the official CardView
Check the official doc for more info.