[英]Android drawable Shape corner
I have a question about the radius value inside the corners tag, what is this radius means actually? 我有一个关于corners标签内的半径值的问题,这个半径实际上意味着什么? is there a center or what?
有中心吗? sample xml:
样本xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:radius="20dp" />
<solid
android:color="@android:color/transparent" />
<stroke
android:color="#FFFFFF"
android:width="2dp" />
<size
android:width="165dp"
android:height="40dp" />
I will demo for you. 我将为您演示。 Here is the original rectangle
这是原始矩形
In your xml file 在您的xml文件中
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="45dp" />
<solid android:color="#22B14C" />
</shape>
The result 结果
4 corners will be rounded by default, if you want round at a specific corner, you can use 4 of these tags: 默认情况下,将对4个角进行四舍五入,如果要在特定的角处四舍五入,则可以使用以下标记中的4个:
Another example using android:bottomLeftRadius
使用
android:bottomLeftRadius
另一个示例
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomLeftRadius="45dp"/>
<solid android:color="#22B14C" />
</shape>
The result 结果
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.