Blog Archives


In an android project, I need create a oval shape textview to show some warning information, a demo like below.

oval shape textview in android

In this demo, i created a oval shap textview to show “This is a text”, if you also want to realize it, you can do as these steps.

Step 1: Create a background drawable xml file for this textview

You can create a xml file in res/drawable , it may call floatwarning_text.xml, then you can copy code below into this file and save it.


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
 <solid android:color="#cce8cf" />
 <corners android:radius="100dp"/>
 <stroke android:color="#cccacb" android:width="1dp"/>
 <padding android:left="5dp" android:top="5dp"
 android:right="5dp" android:bottom="5dp" />
</shape>