当前位置:网站首页>Cardview usage and properties

Cardview usage and properties

2022-06-10 13:30:00 yechaoa

Very simple to use , Not many attributes , There are few commonly used , It comes with shadows and rounded corners

compile 'com.android.support:cardview-v7:25.3.1'
<android.support.v7.widget.CardView
        android:id="@+id/cardView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:foreground="?android:attr/selectableItemBackground"
        app:cardBackgroundColor="#1296db"
        app:cardCornerRadius="10dp"
        app:cardElevation="10dp"
        app:contentPadding="10dp">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/card_view"
            android:textColor="#fff"/>

    </android.support.v7.widget.CardView>

Two common attributes :

app:cardBackgroundColor Set the background color

app:contentPadding Set contents padding

other :

app:cardCornerRadius This is to set the fillet size app:cardElevation This is the setup z The shadow of the axis app:cardMaxElevation This is the setup z The maximum height of the shaft app:cardUseCompatPadding Whether to use CompatPadding app:cardPreventCornerOverlap Whether to use PreventCornerOverlap app:contentPaddingLeft Set the left side of the content padding app:contentPaddingTop Set the top of the content padding app:contentPaddingRight Set the right side of the content padding app:contentPaddingBottom Set the bottom of the content padding

Gituhb:https://github.com/yechaoa/MaterialDesign

原网站

版权声明
本文为[yechaoa]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101254124413.html