在KitKat上的Cardview周围出现了意想不到的白色框架,但在Lollipop上却没有



我在kitkat上的cardview周围有一个1或2 dp厚的无法解释的白色框架。这个白色框架没有出现在Lollipop上,这是我所期望的。

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:cardview="http://schemas.android.com/apk/res-auto"
    android:id="@+id/podcasts_cardView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal"
    android:background="?attr/colorPrimary"
    cardview:cardUseCompatPadding="true"
    cardview:cardCornerRadius="3dp"
    cardview:cardElevation="5dp">

请注意,colorPrimary主题属性是深蓝色的,我使用:

cardview:cardUseCompatPadding="true"

处理平台间的填充问题。

我也有这个问题。试着打电话:

setPreventCornerOverlap(false);

在CardView上。这对我来说很有效。

另外,您可能不需要cardUseCompatPadding = "true"

相关内容

最新更新