Reputation: 16813
I am planning to use CardView
and RecyclerView
in my current application replacing the GridView
. However, these views (CardView
and RecyclerView
) are supported on Lollipop (5.0)
and onwards.
I wonder, what would happened if a user has operating system lower than Lollipop
, like Kitkat
?
How could I support that devices?
Upvotes: 3
Views: 3573
Reputation: 15798
They are part of Android Support libraries
v7. You can use them by adding following support libraries in your gradle file:
dependencies {
...
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
}
And you can define a RecyclerView
from Support Library
:
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
For more, take a look at official guidelines:
http://developer.android.com/training/material/lists-cards.html
Upvotes: 5
Reputation: 20699
they come as a part of "support" or "compat" packages, so both components should be available also in pre-kitkat versions
Upvotes: 1