我正在创建一个用作按钮背景的形状。我正在制作一条按钮,左边的那个在左边有圆角,右边最后一个在右边有圆角。这非常简单,api 文档向您展示了如何操作。但是,当我使用 android:topLeftRadius
和 android:bottomLeftRadius
时,UI 中的结果就像我放置了 bottomRightRadius 一样。另一方也有同样的行为。看起来无论是谁实现了这个交换 bottomRight 和 bottomLeft。我将在下面发布一段代码。
我可能会遗漏一些合乎逻辑的原因吗?或者,如果这是 Android 工程师的错误,一旦他们修复它,它会保持向后兼容吗?我想他们必须使所有新属性保持旧属性有效(可能是 leftTop 而不是 topLeft?)。
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<solid android:color="#99000000" />
<padding
android:top="8dp"
android:left="8dp"
android:right="8dp"
android:bottom="8dp" />
<corners
android:topLeftRadius="8dp"
android:bottomRightRadius="8dp" />
</shape>
</item>
最佳答案
看起来像一个错误,请参阅 this issue和 this question .
关于android - Android xml 形状声明中的滑稽错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4379478/