Android

Android去除CardView默认的阴影

2021-05-14  本文已影响0人  Sarah_Y

平时使用CardView默认是带有阴影效果的,如果不想要阴影效果,只需要将以下属性设置为0即可:

app:cardElevation="0dp"
app:cardMaxElevation="0dp"
image.gif

完整的使用如下:

    <androidx.cardview.widget.CardView 
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        app:cardBackgroundColor="#ffffff"
        app:cardCornerRadius="10dp"
        app:cardElevation="0dp"
        app:cardMaxElevation="0dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            .......
        </LinearLayout>
    </androidx.cardview.widget.CardView>
image.gif
上一篇 下一篇

猜你喜欢

热点阅读