CardView is a layout control in the new Android 5.0 feature--material design that displays a rounded, card-like view through property settings.
1. CardView Properties:
App:cardCornerRadius:CardView Fillet size app:cardElevation:CardView shadow size app:cardMaxElevation:CardView maximum shadow Size whether the content in the App:cardPreventCornerOverlap:CardView overlaps with the fillet, true does not overlap Note: If you have a picture of a fill layout in CardView, If you do not set Cardpreventcorneroverlap to true, the four corners of the picture will extend beyond the rounded corners of the CardView
2. Demo Code:
<Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"Xmlns:app= "Http://schemas.android.com/apk/res-auto"Android:id= "@+id/activity_main"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"> <Android.support.v7.widget.CardViewAndroid:layout_width= "Match_parent"Android:layout_height= "200.0dip"Android:layout_margin= "20.0dip"App:cardcornerradius= "10.0dip"app:cardelevation= "5.0dip"app:cardmaxelevation= "15.0dip"App:cardpreventcorneroverlap= "true"> <ImageViewAndroid:layout_width= "Match_parent"Android:layout_height= "Match_parent"android:contentdescription= "@string/app_name"Android:scaletype= "Centercrop"android:src= "@mipmap/bg" /> <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:layout_gravity= "Center"Android:text= "This is A CardView"Android:textcolor= "#FFFFFFFF"android:textsize= "24.0SP"Android:textstyle= "Bold" /> </Android.support.v7.widget.CardView></Relativelayout>
Operation Result:
The above is the introduction of simple use of CardView, the following sticker code on the cloud source, for your reference.
Demo Address
Use of the CardView "ANDROID-MD"