[置顶] android中cardview的基本使用
16lz
2021-01-25
cardView的基本使用 留个demo 做个小小的备份
cardView个人感觉类似于xml布局 shape的效果
首先在项目的build.gradle中添加引用
dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:cardview-v7:23.1.1'}
xml布局文件
<android.support.v7.widget.CardView xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="20dp" app:cardBackgroundColor="#303069" app:cardCornerRadius="8dp" >主要属性
app:cardElevation
阴影的大小app:cardMaxElevation
阴影最大高度app:cardBackgroundColor
卡片的背景色app:cardCornerRadius
卡片的圆角大小app:contentPadding
卡片内容于边距的间隔
更多相关文章
- Android(安卓)layer-list的属性和使用详解(阴影、边框效果)
- Android引导页播放视频——使用VideoView
- Android(安卓)include使用
- achartengine与Android中ScrollView的冲突问题
- android实现携程购票起始点位置交换
- View Touch 事件分发
- 安卓开发:TabHost 选项卡的基本用法
- 【30篇突击 android】源码统计 十七
- Android(安卓)Material Design控件学习(一)——TabLayout的用法