I know how to use rounded corner for a view would be something like this:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp"/>
</shape>
What is the range for radius? Is it 0 to 100 dp?
There is no "range". Dp means device pixels. So if your view is 100dp
the normal range would be from 0
to 50
(since setting a border radius larger than half of the width or height it would look rather weird).
But basically there is no limit.
Also taking into account that values above half the size will be treated like half the size (so a border radius of 1000dp
on a 100dp
image will still be only 50dp
border.)
And values below zero are the same as zero.
This gives you a nice option to always have completely round borders by defining a very large radius (hacky).
There is no range. You can have any value as the radius, negative or positive values.
Negative values ( like -40dp
) has no effect on the corner radius. This is same as giving corner radius as 0dp
.
Positive values ( like 40dp
) has an effect, but only up to half the size of the view. Anything more than that, then it remains the same. If the height of the view is 200dp
, then corner radius of 200dp
behaves the same way as 100dp
.
As other guys already said, there's no range for android:radius
property.
However, I'd suspect that you would need a round/circular shape independent of its size (width and height). If I'm right, you could use oval
type shapes:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<gradient
android:startColor="#FFFF0000"
android:endColor="#80FF00FF"
android:angle="270"/>
</shape>
Using this way you should make sure alpha channel of startColor
is 00
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With