3

I noticed my cardviews have extra elevation on every side to draw the shadow. I read adding card_view:cardUseCompatPadding="true" and card_view:cardPreventCornerOverlap="false" but I can still see some margin (like 2dp, or padding).

My card:

<android.support.v7.widget.CardView
            android:layout_width="match_parent"
            android:layout_height="200dp"
            android:layout_margin="@dimen/card_margin"
            card_view:cardBackgroundColor="@color/white"
            card_view:cardUseCompatPadding="true"
            card_view:cardPreventCornerOverlap="false" /> 

EDIT: As I found out, this issue is caused by using xmlns:card_view="http://schemas.android.com/apk/res-auto" instead of xmlns:card_view="http://schemas.android.com/tools". The problem is, setting card background using res-auto works fine, but setting it by using tools doesn't work. On the other hand setting card_view:cardUseCompatPadding works with tools but not with res-auto. If anyone knows why this is happening please let me know.

EDIT2 As it turns out, the emulator v23 draws both cards the same, but doesn't apply the background when using tools, thus taking res-auto seems to be the right choice. So this only seems to be a samsung issue.

qwertz
  • 6,206
  • 9
  • 40
  • 62

0 Answers0