Rounded TextView in Android

October 5th, 2011

Create res/drawable/rounded.xml

1
2
3
4
5
6
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
	<solid android:color="#ffffff"/>
	<corners android:radius="5px"/>
	<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> 
</shape>

Set your TextView background value to rounded.xml

1
2
3
4
5
6
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:text="Hello World"
    android:background="@drawable/rounded"
/>

Related posts:

  1. How to Make Tiled Background in Android
  2. Remove Shadow from ListView in Android

Tags: