Rounded corner for textview in android

  1. Create rounded_corner.xml in the drawable folder and add the following content,

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >         
       <stroke
           android:width="1dp"
           android:color="@color/common_border_color" />
    
       <solid android:color="#ffffff" />
    
       <padding
            android:left="1dp"
            android:right="1dp"
            android:bottom="1dp"
            android:top="1dp" />
    
       <corners android:radius="5dp" />
    </shape>
    
  2. Set this drawable in the TextView background property like so:

    android:background="@drawable/rounded_corner"
    

I hope this is useful for you.

Leave a Comment

tech