CardView的基本用法
来源:互联网 发布:php高并发是什么意思 编辑:程序博客网 时间:2024/06/07 00:32
今天主要是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>
- 1
- 2
- 3
- 4
- 5
下面看效果:
这是不加CardView是的效果的链接,如图:
这是添加了CardView的效果图:
阅读全文
0 0
- CardView的基本用法
- (转)CardView的基本用法
- (4.1.51)CardView的基本用法
- Material Design之CardView的基本用法
- CardView的基本属性
- CardView的基本使用
- CardView控件的用法
- Android CardView的基本使用
- RecyclerView CardView的基本使用
- CardView的简介和用法
- android中cardview的基本使用
- V7 控件 CardView的基本使用
- Android组件之CardView的基本使用
- Android RecyclerView 和CardView的用法
- CardView 简易用法
- RecycleView和CardView的简单介绍和用法
- CardView,RecyclerView的使用
- CardView属性的解释
- memcache安装和下载(win7)及登陆
- 自定义Writable类型
- 关于shiro后台权限改动,重新登录后发现权限还是以前的问题的解决
- VS2015相关配置总结
- Linux 基本操作指令
- CardView的基本用法
- 升级项目 swift:2.3 -> 3.2
- Mac firefox 插件Adobe Flash已崩溃 重新载入页面以再试一次 Shockwave Flash has crashed.
- 5分钟理解udev
- openfire安装和部署
- GitHub上搭建博客&增加相册功能
- appium启动app启动的activity的方法总结
- 十八、python self.write
- laravel稀罕的Eloquent模型的用法