1、CardView是FrameLayout的擴展冗恨,里面可添加組件##
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
app:cardMaxElevation="10dp"
app:contentPadding="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
android:padding="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="wozhende shi rile goule a "
android:gravity="center"/>
</android.support.v7.widget.CardView>
2塘偎、屬性介紹##
1. app:cardCornerRadius="10dp"http://cardView的圓角屬性設置
2. app:cardElevation="5dp"http://cardView的陰影大小設置
3. app:cardMaxElevation="10dp"http://cardView的陰影的最大大小
4. app:contentPadding="10dp"http://設置內邊距
5. app:cardPreventCornerOverlap="true"http://在V20和之前的版本中添加內邊距,這個屬性為了防止內容和邊角的重疊
6. app:cardUseCompatPadding="true"http://設置內邊距亚侠,V21+的版本和之前的版本仍舊具有一樣的計算方式