Button With Rounded Corner In Android Studio [Design & Radius]

Button with rounded corner in android Studio


To create Button with round corner in android studio  we have to create and external xml design in drawable . External xml  which we have created ,  will include the shape and color of the button and also manage how much radius we will give to button corners .

To create round corner xml file we have to right click on drawable folder and then click on drawable resource file and give it any name .

XML of Round Shape design


<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
    <shape android:shape="rectangle">
        <solid android:color="#eda4a4"></solid>
        <corners android:radius="35dp"></corners>
        <stroke  android:width="2dp"></stroke>
    </shape>
</item>
</selector>

Now to add this design into your button as shown in the below code . Xml of round shape design will be added to the background of the button , so that it can support design as well as background color also .

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context="softwoodcoder.com.test.home">



    <Button
        android:layout_width="260dp"
        android:layout_height="60dp"
        android:paddingLeft="15dp"
        android:textSize="20dp"
        android:layout_marginTop="150dp"
        android:layout_marginLeft="50dp"
        android:textColor="#160d0d"
        android:background="@drawable/roundcorner"
        android:hint="Button with round corner " />
</RelativeLayout>

output:-


Button With Rounded Corner In Android Studio

After adding we will get button with rounded corner , we can also increase of decrease the radius of the button corners .

Stay connected with softwoodcoder for more tips and tricks about android programming and other .

This Post Has Been Viewed 209 Times

Ajay Kumar

Ajay kumar is young indian boy who enjoy coding and passionate to make , break & Develop New Codes .

One thought on “Button With Rounded Corner In Android Studio [Design & Radius]

Leave a Reply

Your email address will not be published. Required fields are marked *