CardView的具体使用方法
来源:互联网 发布:qq电脑软件管家 编辑:程序博客网 时间:2024/05/18 02:49
今天主要是CardView的用法,CardView是在安卓5.0提出的卡片式控件。首先介绍一下它的配置。
在gradle文件下添加依赖库:
compile 'com.android.support:cardview-v7:22.2.1'
其次介绍一下它的基本属性:
app:cardBackgroundColor这是设置背景颜色
app:cardCornerRadius这是设置圆角大小
app:cardElevation这是设置z轴的阴影
app:cardMaxElevation这是设置z轴的最大高度值
app:cardUseCompatPadding是否使用CompatPadding
app:cardPreventCornerOverlap是否使用PreventCornerOverlap
app:contentPadding 设置内容的padding
app:contentPaddingLeft 设置内容的左padding
app:contentPaddingTop 设置内容的上padding
app:contentPaddingRight 设置内容的右padding
app:contentPaddingBottom 设置内容的底padding
CardView是在布局中使用的:
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:background="@color/gray"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" app:cardBackgroundColor="@color/blue" app:cardCornerRadius="16dp" app:cardElevation="16dp"> <TextView android:id="@+id/id_num" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_margin="10dp" android:gravity="center" android:textColor="@color/white" android:textSize="20sp" /> </android.support.v7.widget.CardView></FrameLayout>
下面看效果:
http://blog.csdn.net/javacainiao931121/article/details/51704672
这是不加CardView是的效果的链接,如图:
这是添加了CardView的效果图:
4 5
- CardView的具体使用方法
- thickbox的具体使用方法
- Criteria 的具体使用方法
- safearray 的具体使用方法
- RegisterHotKey的具体使用方法
- TortoiseSVN的具体使用方法
- 反射的具体使用方法
- sass的具体使用方法
- phylip的具体使用方法
- inout的具体使用方法
- Criteria 接口的具体使用方法
- NC瑞士军刀的具体使用方法
- NC瑞士军刀的具体使用方法
- 关于fstream的具体使用方法
- Android CardView简单使用方法
- fushionchart的Pie3D的具体使用方法
- VB中资源文件的具体使用方法
- matlab中随机函数的具体使用方法
- 穷举法解决百钱百鸡问题
- angularjs 入门实用
- 快速学习者的高效学习策略
- udev详解
- 自定义HorizontalScrollView
- CardView的具体使用方法
- android 自定义控件 使用declare-styleable进行配置属性(源码角度)
- 学习如何学习
- 开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
- idea编辑器部署tomcat
- Java高级排序(希尔排序,快速排序,堆排序,归并排序,桶排序)
- Xgboost的一些坑
- cpio打包和压包*.cpio.gz操作方法示例
- 句法依存关系测试