相关疑难解决方法(0)

Cardview - 卡周围的白色边框

我正在使用cardview作为我正在编写的自定义视图的根.我使用的是v7支持库.我的XML看起来像这样:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_marginRight="6dp"
        card_view:cardElevation="0dp">

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

        <!-- some other views -->
    </LinearLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)

我的问题是我的卡片视图周围有一个白色边框.它看起来像是指示高度,因为它在右侧较厚.我试过调整,cardElevationMaxCardElevation在我的XML中这样: card_view:cardElevation="0dp"

并在我的自定义视图中的代码中扩展CardView并使用此布局:

setCardElevation(0);
setMaxCardElevation(0);
Run Code Online (Sandbox Code Playgroud)

但白色边界仍然存在.我不知道如何摆脱它.如果有人对此为何发生任何意见或建议如何删除白色边框,我们将不胜感激.非常感谢.

android android-cardview

31
推荐指数
1
解决办法
3万
查看次数

标签 统计

android ×1

android-cardview ×1