CardView. , : com.android.support:cardview-v7:27.0.2. build.gradle
, simple_list_item_1.xml, XML, , ListView !
XML CardView , , simple_list_item_1.xml:
<RelativeLayout
android:id="main_layout"
android:width="match_parent"
android:height="wrap_content">
...
//Other layouts and normal code here.
...
</RelativeLayout>
:
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp">
<RelativeLayout
android:id="main_layout"
android:width="match_parent"
android:height="wrap_content">
...
//Other layouts and normal code here.
...
</RelativeLayout>
</android.support.v7.widget.CardView>
card_view:cardCornerRadius CardView, !
P.S. card_view:cardElevation, , , , -!
, ;)
, :
1)
2) A ( RecyclerView)
3) Also disclaimer: traditionally CardViewused only with RecyclerView , this should lead to the fact that a CardViewcan only be used with RecyclerViewand nothing else. This is a common misconception, CardViewis a design element and has nothing to do with RecyclerView, they can be used in any way you want!
This is how rounded would look CardView(minus ListViewi.e. CardViewby itself). See one of my projects.
source
share