【问题标题】:CardView rounded corner gets unexpected white colorsCardView 圆角得到意想不到的白色
【发布时间】:2020-07-30 04:53:35
【问题描述】:

在 CardView 中使用圆角时,在圆角区域显示白色边框,在黑暗环境中大部分可见。为了更容易理解,请检查所附图像。

这里是xml

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorTransparent"
    android:orientation="vertical"
    android:padding="4sp">


    <androidx.cardview.widget.CardView
        android:id="@+id/image_view_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:layout_marginBottom="20dp"
        android:background="@color/colorTransparent"
        app:cardCornerRadius="20dp"
        app:cardElevation="4dp">


        <ImageView
            android:id="@+id/iv_themes"
            android:layout_width="match_parent"
            android:layout_height="110dp"
            android:background="@color/colorTransparent"
            android:gravity="center"
            android:scaleType="centerCrop"
            android:src="@mipmap/tm_2_mip_background" />

    </androidx.cardview.widget.CardView>

</LinearLayout>

【问题讨论】:

    标签: android android-layout


    【解决方案1】:

    我最近遇到了同样的问题。 将 app:cardBackgroundColor="@color/transparent" 添加到 CardView 就可以了。

    【讨论】:

    • 您,先生,是我的救星!在浪费了很多时间之后,您的解决方案为我解决了这个问题!
    • 哥们你也是我的救星!!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-01-06
    • 2018-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多