<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" card:cardCornerRadius="0dp" card:cardElevation="2dp" card:cardMaxElevation="6dp" > <TextView android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="10dp" android:textSize="25sp" android:text="@string/app_name" /> </android.support.v7.widget.CardView><!--cardMaxElevation:最大卡片阴影的宽度--> <!--cardElevation:卡片阴影的宽度--> <!--cardBackgroundColor:卡片的背景颜色--> <!--cardCornerRadius :卡片的圆角半径-->
需要引用jar包
com.android.support:cardview-v7:24.0.0-alpha2