And I want to get dynamic data to show on the screen. Dynamic data coming from a webservice.
So, do I need to use RecyclerView with CardView Layout to make the data dynamic?
How can I make my CardView look like elements of a ListView?
And I want to get dynamic data to show on the screen. Dynamic data coming from a webservice.
So, do I need to use RecyclerView with CardView Layout to make the data dynamic?
How can I make my CardView look like elements of a ListView?
First, after the project is created, go to the file build.gradle (app)
and add the following dependencies:
compile ‘com.android.support:cardview-v7:21.0.+’
compile ‘com.android.support:recyclerview-v7:21.0.+’
Then there's an item in your list, which is probably defined in your adapter . The following code example shows how to include a widget widget with layout :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
... >
<!-- Um CardView com um TextView dentro -->
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v7.widget.CardView>
</LinearLayout>
See the how to create lists and cards documentation at .