Cardview海拔不与androidx文物工作

问题描述 投票:1回答:1

在更新我的android studio 3.3并将我的项目迁移到androidx工件后,我的卡片视图高程停止工作并显示阴影。

<androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:elevation="@dimen/card_margin"
        app:cardCornerRadius="@dimen/card_margin">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">
               <!--Other Code-->
        </LinearLayout>
    </androidx.cardview.widget.CardView>
android-cardview androidx cardview
1个回答
1
投票

app:cardElevation="10dp"属性添加到cardview。

<androidx.cardview.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="@dimen/card_margin"
    **app:cardElevation="@dimen/card_margin"**
    app:cardCornerRadius="@dimen/card_margin">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
           <!--Other Code-->
    </LinearLayout>
</androidx.cardview.widget.CardView>
© www.soinside.com 2019 - 2024. All rights reserved.