Rounded corners on material button –

January 7, 2021 by No Comments

Development issue/problem:

I follow the advice of similar questions to create a button style, as suggested in the Design Materials section.

However, I have to change the radius of the angle and I couldn’t do this by inheriting the Widget.AppCompat.Button.Colour style and setting the radius parameter.

How can I have the same style, but with rounded corners?

How can I solve this problem?

Solution 1:


Gabriele Mariotti’s answer below is better.

Previous answer:

You have to inherit this style.

Add to your style.xml :

Add the file drawable/rounded_shape.xml:

And finally, in your layout:

Edit: The answer has been adjusted to use the theme color, which is not hard-coded.

Solution 2:

Hardware Component Library:.

Add a dependency to your build.gradle :

Dependencies {format ‘’}.

In this case you can use the MaterialButton in the layout file:

Use the app:cornerRadius attribute to change the corner radius. The angles are rounded to the specified dimensions.

You can also adjust the angles using the shapeAppearanceOverlay attribute.

The official document is here and all Android specifications can be found here.

If you are working with Jetpack Compose (1.0.0-alpha02), use the Shape parameter :

Button( onClick = { /* Do something! */ }, Form
= RoundedCornerShape(8.dp)) {

Button (modify = Modify.padding(16.dp),
onClick = { /* Do something! */ },
shape = roundedCornerShape (
topLeftPercent = 50,
topRightPercent = 0,
bottomRightPercent = 0,
bottomLeftPercent = 50
) {

Former support library:

With the new 28.0.0 support library, the design library now includes a Materials button.

You can insert this button into our layout file:

Use this attribute to set the corner radius:

  • app:cornerRadius: Sets the radius used for the button angles.

Dependencies { version

Solution 3:

Rounded material button with wrinkle effect

Create a file in the ripple.xml rendering directory.

Create a file in the completed_shape.xml rendered directory.

And your button:

Solution 4:

Now use the MaterialButton for buttons with rounded contours and many other things you can do with it.

and add app:cornerRadius=8 for rounded corners

and don’t forget to add the Google Material libraries to build.gradle.


Solution No 5:

I’ll tell you my exact solution to this. You can place elements (button functionality) in the selection tags.

The second element of the selection tag has the opposite behaviour. You can add as much as the selector (button behavior)
ADD THIS DRAWABLE XML AS BONAL BUTTON ANDroid:[email protected]/ce xml.

// the first element is included in the report, so it is automatically turned off.

Solution No 6:

Don’t forget to set layout_width and layout_height of the cardView to wrap_content, and all fields needed for the button should be applied to the cardView.

Solution No 7:

Try the following code Create a renderable file called circular_button.xml and paste the following code.

Then change the background of the button for this rendered file.

If you need a round button, you can use the image below.

Good luck!

Related Tags:

material button rounded corners flutter,angular material rounded corners,android material button circle,android material cornerradius,custom materialbutton,android material button stroke not working,material button height android,material button radius flutter,material design 1 vs 2,android material button background drawable,custom button design in android,materialbutton cornerradius not working,kotlin button round corner,materialshapedrawable,cutcornertreatment,shapeappearanceoverlay programmatically,android triangleedgetreatment,shapeableimageview stroke,shapeableimageview background,shapeweb,material-ui,material button android example,material button android library,angular material button rounded corners,how to round the edges of a button android,rounded corner button with background color in android,material button background drawable,rounded button android,custom material button,app:cornerradius

Leave a Comment

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