ImageView with only one rounded corner

Also if you want to get rid of writing code in ".java" file. Then you can define style like below and just add it to your ShapeableImageView:

<com.google.android.material.imageview.ShapeableImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ex_image"
    app:shapeAppearanceOverlay="@style/roundedImageView"
    />

then:

<style name="roundedImageView" parent="">
    <item name="cornerFamilyTopRight">rounded</item>
    <item name="cornerSizeTopRight">30dp</item>
</style>

The Material Components library introduced the ShapeableImageView starting from the version 1.2.0-alpha03.

Just use something like:

  <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      android:scaleType="centerInside"
      android:adjustViewBounds="true"
      ../>

then in your code you can apply the ShapeAppearanceModel with:

ShapeableImageView imageView = findViewById(R.id.image_view);
float radius = getResources().getDimension(R.dimen.default_corner_radius);
imageView.setShapeAppearanceModel(imageView.getShapeAppearanceModel()
    .toBuilder()
    .setTopRightCorner(CornerFamily.ROUNDED,radius)
    .build());

enter image description here

You can also apply in the xml the shapeAppearanceOverlay parameter:

<com.google.android.material.imageview.ShapeableImageView
      app:shapeAppearanceOverlay="@style/customRroundedImageView"
      app:srcCompat="@drawable/ic_image" />

with:

  <style name="customRoundedImageView" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">0dp</item>   
    <item name="cornerSizeTopRight">8dp</item>
  </style>

With jetpack compose you can apply the clip Modifier using a RoundedCornerShape:

Image(painterResource(id = R.drawable.xxx),
    contentDescription = "xxxx",
    contentScale = ContentScale.Crop,
    modifier = Modifier
        .size(xx.dp,xx.dp)
        .clip(RoundedCornerShape(topStart = 12.dp)),
)

enter image description here