AndroidStudio 中引入CardView需要在build.gradle中添加依赖:compile'com.android.support:cardview-v7:23.4.0'
设置CardView的背景颜色 | |
设置CardView拐角的半径 (dp) | |
设置CardView的高度 | |
阴影最大高度 | |
是否添加内边距(避免内容与边缘重叠) | |
Add padding in API v21+ as well to have the same measurements with previous versions. | |
设置内边距: |
|
Inner padding between the edges of the Card and children of the CardView. | |
Inner padding between the bottom edge of the Card and children of the CardView. | |
Inner padding between the left edge of the Card and children of the CardView. | |
Inner padding between the right edge of the Card and children of the CardView. | |
contentPaddingTop | Inner padding between the top edge of the Card and children of the CardView. |
可以添加 android:foreground="?android:attr/selectableItemBackground" 给CardView设置点击后的水波纹效果.