u2gilles
u2gilles

Reputation: 7393

Unexecpted white frame around Cardview on KitKat but not on Lollipop

I have an unexplained white frame of 1 or 2 dp thick around my cardview on kitkat. This white frame does not appear on Lollipop, which is what I expect.

<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">

Please note that colorPrimary theme attribute is dark blue and that i am using :

cardview:cardUseCompatPadding="true"

which takes care of the padding issue over platforms.

Upvotes: 1

Views: 1736

Answers (1)

Maggie P
Maggie P

Reputation: 46

I had this problem too. Try calling:

setPreventCornerOverlap(false);

on the CardView. That is what worked for me.

Also - you may not need cardUseCompatPadding = "true"

Upvotes: 3

Related Questions