Is it possible to make ListView cards like this?
2 answers
use the CardView widget as an item list
<android.support.v7.widget.CardView android:id="@+id/card" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FEFEFE" android:layout_margin="8dp" app:cardCornerRadius="4dp"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaleType="centerCrop"/> <TextView android:id="@+id/text_header" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </android.support.v7.widget.CardView> Layout the inside of the item, build yourself as you need, this is just an example. You will also need a custom adapter to bind the data to this site.
|
In short, there are many ways, depending on the version. For example, with Android 6.0 (if memory serves) CardView is added. If versions are younger, you can use anything from canvas to GridView.
PS In general, here is an example about which it is
http://www.fandroid.info/primer-ispolzovaniya-cardview-i-recyclerview-v-android
and here sorts
- 2Cards, if I am not mistaken, were presented by Google along with the material design. That was before the release of the 5 android. For younger versions of
CardViewis insupport-v7lib. Neither thecanvasnor theGridViewwill be required. In the reference example aboutRecyclerView, and the question aboutListViewis YuriySPb ♦
|
