Want to get round corner for you android button ?

 

Android round shape :

In designing android layout screens sometimes we want buttons to be android round shape at corners and also we can make it completely circle i.e., O in shape.  

Not only buttons but we can also have rounded layouts, edittext and different other components with the help of this android round shape file.

In this tutorial we will be going through the procedure of preparing this file so that we can use this file through out our app so that we can attain rounded shapes to our components.

 

So let’s start it by

 

Making our shape as rectangle

android:shape="rectangle"

 

Next step is setting up some padding this you can adjust according to you wish.

android:padding="10dp">

 

Then here comes our color.

<solid android:color="#000000"/>

 

At last set you radius at every corner for rounded corner button make sure all the sides are same.Also you can specify the single line as radius which considers the value to all sides.

 

android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"

Creating round.xml :

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:padding="10dp">    
    <solid android:color="#000000"/> 
    <corners android:radius="10dp"/>
</shape>

Save it as a xml file in drawable folder and set this as background to your button.

So as your are setting this as background to your component i recommend you to add the required color to the view so that it will be added within.

Also you can customize the above file with your own requirements and can try and let me know if you find any difficulty.

 

Setting up with you button :

android:background=“@drawable/rounded”

If you have any queries on android round shape do let us know in comment section below.

 

Show Buttons
Hide Buttons
Read previous post:
Android Snackbar Tutorial With Material Design

  Android Snackbar : Android Snackbar displays a piece of message at the bottom of the screen which appears much...

Close