我有一个关于Corners标签内的半径值的问题, 这个半径实际上意味着什么?有中心吗? 样本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" />
答案 0 :(得分:2)
我将为您演示。这是原始矩形
在您的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>
结果
默认情况下,将对4个角进行四舍五入,如果要在特定的角处四舍五入,可以使用以下标记中的4个:
另一个使用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>
结果