0

I have a problem with transparent CardView. It happens when i set CornerRadius attribute to card, without this attribute everything is ok. It looks like this(marked red):enter image description here

Code:

<android.support.v7.widget.CardView <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:id="@+id/item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
card_view:cardCornerRadius="@dimen/some_dimen_here"
card_view:cardUseCompatPadding="true"
card_view:cardBackgroundColor="@android:color/transparent">

How it cane be fixed? any ideas?

Ivan B
  • 394
  • 1
  • 5
  • 18

1 Answers1

0

Hi please remove the card_view:cardBackgroundColor and try

   <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:id="@+id/item"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:orientation="horizontal"
        card_view:cardElevation="4dp"
        card_view:cardCornerRadius="2dp">

    </android.support.v7.widget.CardView>
mahesh87
  • 49
  • 4
  • as i mentioned in question, problem is disappeared when i remove corner radius, but i actually need it(( – Ivan B Feb 01 '17 at 11:09
  • what is value for your @dimen/some_dimen_here ? – mahesh87 Feb 01 '17 at 11:17
  • in this case 0dp. But this dimen can store any value. in case when it f.e. 4dp the same problem. But when we just didn't add it, everything ok. – Ivan B Feb 01 '17 at 11:51