我需要在左上角和上底角设置一个圆角。所以我将形状 xml 设置为按钮作为背景。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/footer_bg_normal" />
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
这在我的手机 (Nexus 4) 上按预期工作
但在平板电脑上它不起作用。
但是,如果我删除角标记的所有属性并仅添加通用半径(对于所有角),它就可以工作。但它在所有 4 个上都有圆角。
android:radius="20dp"
有没有人知道,为什么会这样?我怎样才能为所有设备实现左上角和右上角圆角?
如果这是 Android 中的已知问题,是否有解决方法?
最佳答案
关于Android:形状角半径在平板电脑上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26520826/