在网格视图项之间显示一条细线

Showing a thin line betwen cardview items

如上截图,您可以看到卡片视图覆盖的项目数量,但问题是卡片视图包含两个项目之间的薄层

如何删除这条细线,我的 cardview xml 属性 是

  <?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="wrap_content">

    <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp"
        card_view:cardPreventCornerOverlap="true"
        card_view:cardElevation="10dp"
        card_view:cardBackgroundColor="@color/white"
        card_view:cardCornerRadius="4dp">

    </android.support.v7.widget.CardView>
</RelativeLayout>

改变

card_view:cardElevation="10dp"

对此:

card_view:cardElevation="2dp"

您必须降低卡片高度。更改代码如下

<?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="wrap_content">

    <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:id="@+id/card_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="5dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp"
        card_view:cardPreventCornerOverlap="true"
        card_view:cardElevation="2dp"
        card_view:cardBackgroundColor="@color/white"
        card_view:cardCornerRadius="4dp">

    </android.support.v7.widget.CardView>
</RelativeLayout>