1、CardView是FrameLayout的扩展,里面可添加组件##
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
app:cardMaxElevation="10dp"
app:contentPadding="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true"
android:padding="10dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground">
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="wozhende shi rile goule a "
android:gravity="center"/>
</android.support.v7.widget.CardView>
2、属性介绍##
1. app:cardCornerRadius="10dp"//cardView的圆角属性设置
2. app:cardElevation="5dp"//cardView的阴影大小设置
3. app:cardMaxElevation="10dp"//cardView的阴影的最大大小
4. app:contentPadding="10dp"//设置内边距
5. app:cardPreventCornerOverlap="true"//在V20和之前的版本中添加内边距,这个属性为了防止内容和边角的重叠
6. app:cardUseCompatPadding="true"//设置内边距,V21+的版本和之前的版本仍旧具有一样的计算方式
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。