学习1:CardView的使用

1.引用 

    implementation'com.android.support:cardview-v7:27.1.1'

2.属性 

    app:cardBackgroundColor      设置背景颜色

    app:cardCornerRadius         设置圆角大小

    app:cardElevation            设置z轴阴影高度

    app:cardMaxElevation         设置z轴最大高度值

    app:contentPadding           内容与边距的间隔

     app:contentPaddingLeft       内容与左边的间隔

    app:contentPaddingTop        内容与顶部的间隔

    app:contentPaddingRight      内容与右边的间隔

    app:contentPaddingBottom     内容与底部的间隔    

     app:paddingStart             内容与边距的间隔起始

    app:paddingEnd内容与边距的间隔终止

    app:cardUseCompatPadding     设置内边距,在API21及以上版本和之前的版本仍旧具有一样的计算方式

    app:cardPreventConrerOverlap 在API20及以下版本中添加内边距,这个属性为了防止内容和边角的重叠

3.波纹点击效果

    android:foreground="?android:attr/selectableItemBackground"

4.设置阴影

    app:cardUseCompatPadding="true"

你可能感兴趣的:(学习1:CardView的使用)