Button radius setting programmatically in android

I have a say myButton button. I want to programmatically adjust the radius of the upper left corner of the button. I'm looking for something like

 myButton.setTopLeftCornerRadius(10); 

I searched for a method like "setcornerradius" in eclipse but got nothing.

+4
source share
4 answers

buttons use ImageResources to paint the background.

if you want to get rounded corners from the code without using 9-png images, you can look here

http://programmatic.blogs.ku.dk/2010/06/21/adding-a-background-with-rounded-corners-to-any-view/

+2
source

You can use a shape suitable for this or rounded corner background image. For details on the details, see this post.

How to set angular radii for a button in java code?

Greetings.

+1
source

The button is of type View , and all View in Android occupy rectangular areas. However, you can set the button background to any image you like. Like Shape Drawable with round corners.

0
source

Try this code to draw rounded corners of edittext:

How to create an EditText with rounded corners?

0
source

All Articles