ImageView只有一个圆角

问题描述 投票:0回答:1

我正在尝试使ImageView的一个圆角像下面的图片一样,但右下角。尝试使用背景形状,但根本无法使用。 Glide加载的所有图像。我应该使用ViewOutlineProvider之类的东西吗?有没有有效的方法可以做到这一点?谢谢!

<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <corners
        android:radius="2dp"
        android:bottomRightRadius="20dp"
        android:bottomLeftRadius="0dp"
        android:topLeftRadius="0dp"
        android:topRightRadius="0dp"/>
</shape>

Example from Android Material Docs

android imageview android-xml android-shape android-shapedrawable
1个回答
0
投票
<?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:elevation="@dimen/_10sdp" android:background="@color/white" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/round_one" android:orientation="vertical" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent"> <ImageView android:layout_width="match_parent" android:layout_height="@dimen/_80sdp" android:layout_gravity="center" android:scaleType="fitXY" android:src="@android:drawable/ic_menu_day" /> <TextView android:id="@+id/textView22" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="16dp" android:layout_marginEnd="8dp" android:text="title goes here" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:text="Secondary text" /> </LinearLayout> </androidx.cardview.widget.CardView>

round_one.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/gray" />
    <corners android:topRightRadius="50dp" />
</shape>
© www.soinside.com 2019 - 2024. All rights reserved.