Android新特性v7 - CardView
16lz
2021-01-23
Android新特性v7 - CardView
使用该控件
compile 'com.android.support:cardview-v7:21.+
xml文件
<android.support.v7.widget.CardView android:layout_marginTop="20dp" android:layout_width="wrap_content" android:layout_height="wrap_content" app:cardCornerRadius="10dp" app:cardElevation="5dp" app:contentPadding="10dp" app:cardPreventCornerOverlap="true" ><ImageView android:scaleType="centerCrop" android:src="@mipmap/test" android:layout_width="match_parent" android:layout_height="wrap_content"/></android.support.v7.widget.CardView>
几个属性值
app:cardElevation="5dp"//阴影app:cardElevation 阴影的大小app:cardMaxElevation 阴影最大高度app:cardBackgroundColor 卡片的背景色app:cardCornerRadius 卡片的圆角大小app:contentPadding 卡片内容于边距的间隔app:contentPaddingBottomapp:contentPaddingTopapp:contentPaddingLeftapp:contentPaddingRightapp:contentPaddingStartapp:contentPaddingEndapp:cardUseCompatPadding 设置内边距,V21+的版本和之前的版本仍旧具有一样的计算方式app:cardPreventConrerOverlap 在V20和之前的版本中添加内边距,这个属性为了防止内容和边角的重叠
效果(可以将控件显示为卡片效果)
更多相关文章
- android学习笔记---59_各种图形的使用介绍,android炫酷效果的实
- android win8效果实现进阶(一)
- Android 下拉刷新控件SwipeRefreshLayout结合WebView使用
- android 文本框实现搜索和清空效果
- Android入门:基本控件(一)
- android 触发AppWidget上控件事件来更新AppWidget
- android anim 动画效果
- Android图像处理_浮雕效果
- Android之改变控件的背景及形态