Android:形状角半径在平板电脑上不起作用

标签 android android-button android-background android-shape

我需要在左上角和上底角设置一个圆角。所以我将形状 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) 上按预期工作 enter image description here

但在平板电脑上它不起作用。 enter image description here

但是,如果我删除角标记的所有属性并仅添加通用半径(对于所有角),它就可以工作。但它在所有 4 个上都有圆角。

android:radius="20dp"

有没有人知道,为什么会这样?我怎样才能为所有设备实现左上角和右上角圆角?

如果这是 Android 中的已知问题,是否有解决方法?

最佳答案

您尝试在哪些版本的 Android (API) 上执行这些操作?

角落有一些问题:herehere

关于Android:形状角半径在平板电脑上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26520826/

相关文章:

android - 9 中心为 1 的补丁图像 :1

android - 如何在长按按钮时发送字符流

android - AppCompatEditText 的默认背景是什么?

Android 在 ImageView 中删除背景属性

android - 如何像whatsapp一样设置listView项目背景

java - 如何对编辑文本记录的数据进行操作

android - Android 应用程序能否检查操作系统范围的上下文,例如与网络相关的上下文?

java - Android Studio 0.5.7 不会在操作栏中显示按钮

dalvik.system.PathClassLoader.findClass 中的 java.lang.ClassNotFoundException

java - CheckingButton 后台资源 Id android