如何trim左下角的图像在XML、trim底部的med图像中在cardview内部得到这样的半圆形?附上图片

How to trim image at the bottom left to get such half rounded shape inside cardview in XML, trimmed image at the bottom? Image attached

我正在尝试在 cardview 中添加图像,可以从左下角稍微修剪一下,这样就可以形成与图像中相同的半圆形。请帮助我,因为我不知道该怎么做?

它只是一个带有白色笔划的圆形图像,如您在 this image

你可以使用 ShapeableImageView 使您的图像成为圆形并为其添加描边,您的代码将如下所示

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">
    <!--your main image-->
    <ImageView
        android:id="@+id/imageView"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:src="@color/black"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
    <!--your circular image-->
    <com.google.android.material.imageview.ShapeableImageView
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:padding="8dp"
        android:src="@drawable/ic_launcher_background"
        android:layout_marginTop="-40dp"
        android:layout_marginStart="20dp"
        app:layout_constraintStart_toStartOf="@+id/imageView"
        app:layout_constraintTop_toBottomOf="@+id/imageView"
        app:strokeWidth="8dp"
        app:strokeColor="@color/white"
        app:shapeAppearanceOverlay="@style/circleImageViewStyle"/>
</androidx.constraintlayout.widget.ConstraintLayout>

这里是 circleImageViewStyle,在 themes.xml 文件中

    <style name="circleImageViewStyle" >
        <item name="cornerFamily">rounded</item>
        <item name="cornerSize">50%</item>
    </style>

上面代码的结果看起来像 this