首页 > 解决方案 > 带圆角的卡片视图具有灰色背景

问题描述

我已经为这个问题寻找解决方案几个小时了,我知道有些人在我之前遇到过这个问题,但他们的解决方案对我不起作用。例如app:cardUseCompatPadding="true",不会删除灰色背景,并且 CardElevation 已经设置为 0dp。在这一点上我只是不知道我还能做什么,我希望有人能帮助我:c

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/cardview1"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginRight="50dp"
    android:layout_marginLeft="50dp"
    android:layout_marginTop="225dp"
    android:layout_marginBottom="225dp"
    app:cardCornerRadius="20dp"
    app:cardElevation="0dp"
    app:cardBackgroundColor="@color/colorRedDark">

    <RelativLayout>
    .
    .
    .
    </RelativeLayout>

</androidx.cardview.widget.CardView>

标签: javaandroidrounded-cornerscardview

解决方案


推荐阅读