I need to draw a rounded rectangle in the Android UI. Having the same rounded rectangle for TextView
and EditText
would also be helpful.
In your layout xml do the following:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/holo_red_dark" />
<corners android:radius="32dp" />
</shape>
By changing the android:radius
you can change the amount of "radius" of the corners.
<solid>
is used to define the color of the drawable.
You can use replace android:radius
with android:bottomLeftRadius
, android:bottomRightRadius
, android:topLeftRadius
and android:topRightRadius
to define radius for each corner.