我正试图设置我的卡片cardCornerRadius
,但它不起作用。
看看下面的代码:
CardView ,其中最后一个属性为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">
依赖关系
编译'com.android.support:appcompat-v7:23.3.0' 编译'com.android.support:design:23.3.0' 编译'com.android.support:cardview-v7:23.3.0'
我在控制台中没有收到任何错误,所以我真的不知道发生了什么。
知道该怎么做吗?
谢谢!
答案 0 :(得分:5)
我认为您可能在代码中使用setBackgroundColor
。
如果是这样,请尝试改用setCardBackgroundColor
。
答案 1 :(得分:0)
使用card_view:cardCornerRadius="x"