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新特性v7 - CardView_第1张图片

更多相关文章

  1. android学习笔记---59_各种图形的使用介绍,android炫酷效果的实
  2. android win8效果实现进阶(一)
  3. Android 下拉刷新控件SwipeRefreshLayout结合WebView使用
  4. android 文本框实现搜索和清空效果
  5. Android入门:基本控件(一)
  6. android 触发AppWidget上控件事件来更新AppWidget
  7. android anim 动画效果
  8. Android图像处理_浮雕效果
  9. Android之改变控件的背景及形态

随机推荐

  1. Android中数据存储——SharedPreferences
  2. 选择一款2K-3K的Android机器,犹豫中
  3. 在Android中加载并使用opencv的方法
  4. 鍦ㄧ數鑴戜笂鐢ㄩ紶鏍囧拰閿洏鎺у埗an
  5. Android(安卓)Acrchitecture Components(
  6. [Android]用架构师角度看插件化--章节列
  7. Android NDK开发篇(一):新版NDK环境搭建(
  8. Android 4.4 KITKAT SDK的直接下载链接
  9. Android原生方式获取经纬度和城市信息
  10. [Android实例] Android(安卓)开发者面试