In the designer we're able the change the corner radius of a panel (in degrees).
It's a pretty cool feat, when set to 180 I'm getting some sweet perfectly circular panels.
My question is, how do we change this value by code?
EDIT: My (little big) mistake, the corner radius is in dip, not degrees.
Klaus said:
If you have a square view and set the corner radius to the half of the width you get a circle.
Are you sure ?
A radius cannot be in degrees, only in pixels.
In the Designer the value you enter is considered as a dip value.
In the code you need to use dip values to set it.
If you have a squre view and set the corner radius to the half of the width you get a circle !
I see your point! Thanks for the help!
I guess I always associate round things with angles.
So the final answer is that the roundness can be set like this:
B4X:
Panel1.Color = (Colors.ARGB(255, 255, 255), 2%x)
Klaus said:
Are you sure ?
A radius cannot be in degrees, only in pixels.
In the Designer the value you enter is considered as a dip value.
In the code you need to use dip values to set it.
If you have a squre view and set the corner radius to the half of the width you get a circle !
You guys are totally right!! Indeed a radius is always distance, not an angle!! Also thanks for the tip on creating circles! I will update my code ASAP!!
No ! , don't mix the color property with Background property which deals with drawable. The color drawable defines both color and radius of the corner.