CardView个人总结
来源:互联网 发布:linux 限制访问目录 编辑:程序博客网 时间:2024/04/23 16:02
前言
Android5提供的,在v7包里面
Gradle依赖
compile 'com.android.support:cardview-v7:23.2.0'
特点
Cardview继承自FrameLayout,所以子控件布局规则和FrameLayout的一样
常用属性
card_view:cardElevation 阴影的大小
card_view:cardMaxElevation 阴影最大高度
card_view:cardBackgroundColor 卡片的背景色
card_view:cardCornerRadius 卡片的圆角大小
card_view:contentPadding 卡片内容于边距的间隔
card_view:contentPaddingBottom 卡片内容与底部的边距
card_view:contentPaddingTop 卡片内容与顶部的边距
card_view:contentPaddingLeft 卡片内容与左边的边距
card_view:contentPaddingRight 卡片内容与右边的边距
card_view:contentPaddingStart 卡片内容于边距的间隔起始
card_view:contentPaddingEnd 卡片内容于边距的间隔终止
card_view:cardUseCompatPadding 设置内边距,V21+的版本和之前的版本仍旧具有一样的计算方式
card_view:cardPreventConrerOverlap 在V20和之前的版本中添加内边距,这个属性为了防止内容和边角的重叠
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center"> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="100dp" android:layout_height="0dp" android:layout_weight="1" android:clickable="true" card_view:cardCornerRadius="10dp" android:foreground="?android:attr/selectableItemBackground" card_view:cardElevation="10dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="圆角矩形" /> </android.support.v7.widget.CardView> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_marginTop="50dp" android:layout_width="100dp" android:layout_height="0dp" android:layout_weight="1" android:clickable="true" android:foreground="?android:attr/selectableItemBackground" card_view:cardElevation="10dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="矩形且填充父容器" /> </android.support.v7.widget.CardView> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:layout_width="100dp" android:layout_height="0dp" android:layout_weight="1" android:layout_marginTop="50dp" android:clickable="true" android:foreground="?android:attr/selectableItemBackground" card_view:cardElevation="10dp"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="歌唱祖国3" /> </android.support.v7.widget.CardView></LinearLayout>
0 0
- CardView个人总结
- Android的CardView使用总结
- CardView
- CardView
- CardView
- CardView
- cardview
- CardView
- CardView
- CardView
- CardView
- cardview
- cardview
- CardView
- CardView
- CardView
- CardView
- CardView
- elasticsearch GIS空间查询问题解决
- ES报错dangling index, exists on local file system, but not in cluster metadata, auto import to cluster
- demofacial.py
- LinkedList实现堆栈、队列
- 彩色车牌分割
- CardView个人总结
- excel导出时列超过26时解决办法
- Activitylifecyclecallbacks使用
- ASP.NET MVC 启动定时任务删除某一文件夹下面的全部文件
- 《C++ Primer 第五版》学习笔记-第一章-开始
- Promise对象的含义和基本用法
- spring+redis
- Linux下安装Nodejs
- EigenFace (特征脸方法)