美文网首页
CardView使用总结

CardView使用总结

作者: 淡定丶说的是 | 来源:发表于2016-08-05 15:11 被阅读599次

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+的版本和之前的版本仍旧具有一样的计算方式

相关文章

网友评论

      本文标题:CardView使用总结

      本文链接:https://www.haomeiwen.com/subject/bjwhsttx.html