手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

CardView 设置圆角方法

时间:2024-10-11 23:38:52

1、添加依赖implementation‘com.android.support:cardview-v7:23.4.0’

2、设置CardView的圆角半径app:cardCornerRadius =""设就女蒿鸳置背景颜色app:cardBackgroundColor="设置paddingapp:contentPadding=" "app:contentPaddingTop=" "app:contentPaddingBottom=" "app:contentPaddingLeft=" "app:contentPaddingRight="注意啊:上面是CardView设置背景颜色和padding的方式,如果你直接通过android:padding=" " 和android:background=" "设置,是无效设置Z轴的高度app:cardMaxElevation=" "设置CardView的前景android:foreground =""设置内边距app:contentPadding ="

3、在项目中使用:<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:card_view="..."> <!-- A CardView that contains a TextView --> <android.support.v7.widget.CardView xmlns:card_view="..." android:id="@+id/card_view" android:layout_gravity="center" android:layout_width="200dp" android:layout_height="200dp" card_view:cardCornerRadius="4dp"> <TextView android:id="@+id/info_text" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v7.widget.CardView></LinearLayout>

© 手抄报圈