【发布时间】:2018-03-16 04:34:05
【问题描述】:
Android Studio 版本:2.3.3、Android 4.3
我正在使用 CardView 并希望对图像的角进行圆角处理。
布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="@dimen/card_width"
android:layout_height="@dimen/card_width"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
card_view:cardCornerRadius="15dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/img_lights" />
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
如你所愿,我设置了
card_view:cardCornerRadius="15dp
结果如下:
但是图片的边角不是圆角的。为什么?
【问题讨论】:
标签: android android-layout android-view android-cardview cardview