以下是我根据mãĴď评论所做的事情
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/white">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_smallxx"
android:layout_marginTop="@dimen/margin_normalxx"
android:layout_marginEnd="@dimen/margin_smallxx"
app:cardCornerRadius="10dp"
app:cardElevation="20dp"
android:outlineSpotShadowColor="@color/shadow_color"
>
<LinearLayout
android:id="@+id/ll_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
........
</LinearLayout>
</CardView>
</RelativeLayout>
这意味着我们将拥有卡片视图并将整个布局放入其中......