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和之前的版本中添加内边距,这个属性为了防止内容和边角的重叠

效果(可以将控件显示为卡片效果)

更多相关文章

  1. android学习笔记---59_各种图形的使用介绍,android炫酷效果的实
  2. android 文本框实现搜索和清空效果
  3. android EditText使用指南
  4. android 自定义导航控件
  5. Android(安卓)下拉刷新控件SwipeRefreshLayout结合WebView使用
  6. android视频播放器
  7. 初识ProgressBar
  8. android win8效果实现进阶(一)
  9. android布局 LinearLayout和RelativeLayout

随机推荐

  1. Android(安卓)AlertDialog 对话框开启和
  2. Android(安卓)Native程序crash的一些定位
  3. popupwindow练习
  4. android 固定大小取图片缩略图
  5. Android菜单设计指南
  6. Android(安卓)使用ORMLite操作数据库
  7. Android(安卓)线程模型和 AsyncTask
  8. Android(安卓)Toolchain环境搭建
  9. 在PC电脑上玩Android(安卓)1.x 2.x 3.x
  10. ADB使用小结