【问题标题】:Only top corners rounded in <shape>仅在 <shape> 中圆角的顶角
【发布时间】:2011-11-09 05:32:10
【问题描述】:

我正在尝试使形状的顶角变圆,而底部只是笔直,但我的形状有问题,它正在保存

错误! UnsupportedOperationException: null

当我有

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

我尝试将 1dp 放在底角并取出 android:radius="10dp",但仍然给我一个错误。

带有 Eclipse 的 Android 2.2

谁能帮帮我?

【问题讨论】:

    标签: android


    【解决方案1】:

    Eclipse 中的工具不正确,将其部署到真实设备上,您应该会看到它没有问题。

    【讨论】:

    • 是的,这确实有效,我认为这是一个错误,它不会让我部署谢谢
    • 你知道如何绕过这个错误,因为现在我的屏幕全是灰色的,不能真正正确地看到窗口,这只是在编辑器中。
    • 不确定你的屏幕全是灰色的意思...?
    • 部署前预览应用时eclipse中的图形化布局界面,预览界面有阴影提示有错误。
    【解决方案2】:

    对我来说,当我将 0dip 更改为 0.1dip 时效果很好。在安卓 1.6 上测试

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

    但另一方面,当我使用 0dip 时,我没有收到任何错误。问题是所有的角落都变成了 0dip,所以你可能在 xml 中遇到了另一个错误

    【讨论】:

      【解决方案3】:

      试试

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-05-06
        • 2023-02-03
        • 1970-01-01
        • 2016-03-30
        • 1970-01-01
        • 2016-09-06
        • 2018-02-21
        • 2019-09-21
        相关资源
        最近更新 更多