0

How to create this in android layout i tried many ways but i didn't found any method to do this

Like this image

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="100000dp" />
<solid android:color="#5fb0c9" />
<stroke
    android:width="-5dip"
    android:color="#3da8c9" />
<padding
    android:bottom="-4dp"
    android:left="-4dp"
    android:right="-4dp"
    android:top="-4dp" />
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841

1 Answers1

0

You can use a MaterialCardView and apply a ShapeAppearanceModel.

Something like:

  TriangleEdgeTreatment edgeTreatment = new TriangleEdgeTreatment(getResources().getDimension(R.dimen.cutout_size),true);

  cardView.setShapeAppearanceModel(cardView.getShapeAppearanceModel()
      .toBuilder()
      .setTopEdge(edgeTreatment)
      .build());

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841