Skip to main content

CardView

Overview

CardView card layout

Example

<CardView>
<LinearLayout android:orientation="vertical">
<TextView android:layout_width="match_parent" android:layout_height="wrap_content"
android:padding="20dp" android:text="CardView Demo"/>
<ImageView
android:src="https://upload.jianshu.io/users/upload_avatars/4321745/406ef6d9-28c1-4f35-8cee-37818cc404af.jpg"
android:layout_width="200dp" android:layout_height="200dp" android:scaleType="CENTER_CROP"/>
</LinearLayout>
</CardView>

Properties

Common Properties

See Common Properties

Private Properties

PropertyDescriptionValues
layout_weightChild weightNumber
When the parent is LinearLayout, child controls can set weight
cardBackgroundColorBackground colorNumber
e.g. #888888
cardCornerRadiusCorner radiusNumber
e.g. 20dp
cardElevationZ-axis shadowNumber
e.g. 20dp
cardMaxElevationMaximum Z-axis elevationNumber
e.g. 20dp