You have to use Vector Drawable for creating custom shape as you need.
I have created a sample for the same.
Create custom_vector.xml file under res/drawable/
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="20dp"
android:width="20dp"
android:viewportWidth="400"
android:viewportHeight="400">
<group
android:pivotX="10.0"
android:pivotY="10.0">
<!-- the outside box -->
<!-- top line & top left corner -->
<path android:pathData="M 30 60 H 40 c -40 0 -35 0 -35 35 "
android:strokeColor="#000000" android:strokeWidth="10" />
<!-- left line & bottom left corner -->
<path android:pathData="M 5 64 v 271 c 0 40 0 35 35 35 "
android:strokeColor="#000000" android:strokeWidth="10" />
<!-- bottom line & bottom right corner -->
<path android:pathData="M 30 370 h 330 c 40 0 35 -10 35 -35"
android:strokeColor="#000000" android:strokeWidth="10" />
<!-- right line & top right corner -->
<path android:pathData="M 395 356 v -261 c0 -40 0 -35 -50 -35"
android:strokeColor="#000000" android:strokeWidth="10" />
<!-- top line till end-->
<!-- 140 is the starting point of line after TEXT-->
<path android:pathData="M 140 60 370 60"
android:strokeColor="#000000" android:strokeWidth="10" />
</group>
</vector>
You may have to change the value of last path tag
top line till end
as per your text at the place of 'Name'. You can also modify the shape or corners as you want.
try below...
you achieve this using
ConstraintLayout
.round.xml
Output : see
You have to use Vector Drawable for creating custom shape as you need.
I have created a sample for the same. Create custom_vector.xml file under res/drawable/
You may have to change the value of last path tag
as per your text at the place of 'Name'. You can also modify the shape or corners as you want.
Create a test_layout.xml file under res/layout/
It appears like this screenshot