关闭

CardView简单使用

标签: androidcardview
199人阅读 评论(0) 收藏 举报
分类:

AndroidStudio 中引入CardView需要在build.gradle中添加依赖:compile'com.android.support:cardview-v7:23.4.0'


cardBackgroundColor

 设置CardView的背景颜色

cardCornerRadius

 设置CardView拐角的半径 (dp)

cardElevation

设置CardView的高度

cardMaxElevation

阴影最大高度

cardPreventCornerOverlap

 是否添加内边距(避免内容与边缘重叠)

cardUseCompatPadding

Add padding in API v21+ as well to have the same measurements with previous versions. 

设置内边距:

 

contentPadding

Inner padding between the edges of the Card and children of the CardView. 

contentPaddingBottom

Inner padding between the bottom edge of the Card and children of the CardView. 

contentPaddingLeft

Inner padding between the left edge of the Card and children of the CardView. 

contentPaddingRight

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设置点击后的水波纹效果.



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:27410次
    • 积分:1139
    • 等级:
    • 排名:千里之外
    • 原创:88篇
    • 转载:1篇
    • 译文:0篇
    • 评论:6条