Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cardview, cardCornerRadius not working

I'm trying to set to my cards a cardCornerRadius but its not working.

Take a look my code below:

CardView where the last property is the cardCornerRadius

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/user_card_view"
    android:layout_width="match_parent"
    android:layout_height="@dimen/card_height"
    android:layout_gravity="center"
    android:layout_marginBottom="@dimen/md_keylines"
    android:layout_marginLeft="@dimen/md_keylines"
    android:layout_marginRight="@dimen/md_keylines"
    android:foreground="?attr/selectableItemBackground"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:cardCornerRadius="3dp">

Dependencies

compile 'com.android.support:appcompat-v7:23.3.0' compile 'com.android.support:design:23.3.0' compile 'com.android.support:cardview-v7:23.3.0'

I didn't get any error in the console, so I really don't know what is happening.

Any idea how to do it?

Thanks!

like image 249
gon250 Avatar asked Apr 21 '16 19:04

gon250


1 Answers

I think you may be usingsetBackgroundColor in your code.

If so, try to use setCardBackgroundColor instead.

like image 111
張羊柱 Avatar answered Oct 04 '22 05:10

張羊柱