为什么角(半径)不能不同?

2023-12-27

我试图:

<corners 
 android:bottomRightRadius="0dp"
 android:bottomLeftRadius="0dp"
 android:topLeftRadius="10dp"
 android:topRightRadius="10dp"/>

没有圆角半径。

<corners 
 android:bottomRightRadius="1dp"
 android:bottomLeftRadius="1dp"
 android:topLeftRadius="10dp"
 android:topRightRadius="10dp"/>

所有角半径 == 10dp。

是否可能以及如何指定角点:10dp(左上)10dp(右上)0 0(底部)?


在 Android 开发者中http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

注意:每个角必须(最初)提供大于 1 的角半径,否则没有圆角。如果您不希望特定的角为圆角,解决方法是使用 android:radius 设置大于 1 的默认角半径,然后用您真正想要的值覆盖每个角,提供零(“0dp”) )您不需要圆角的地方。

如果您执行代码,即使有预览警告,它看起来也很好,我认为这是一个错误或类似的东西。这是我写的:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="@color/brown_light"/>
        <corners
            android:topLeftRadius="0dp"
            android:topRightRadius="0dp"
            android:bottomLeftRadius="30dp"
            android:bottomRightRadius="30dp"
            />

</shape>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么角(半径)不能不同? 的相关文章

随机推荐