Android:使用圆角 xml 在开发过程中显示错误

发布于 2024-12-20 08:23:12 字数 826 浏览 0 评论 0原文

在我的应用程序中,我使用以下代码创建圆形边框:

<?xml version="1.0" encoding="UTF-8"?> 
<shape      
     xmlns:android="http://schemas.android.com/apk/res/android">     
     <stroke          
            android:width="1dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="10px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>

虽然我这样做一切正常,但在 GraphocalLayout 中的 Eclipse 中,我看到如下图所示的错误消息。 在此处输入图像描述

这有什么问题吗?我想删除此消息,那么我应该做什么? 谢谢。

In My application i am Creating rounded border using this code:

<?xml version="1.0" encoding="UTF-8"?> 
<shape      
     xmlns:android="http://schemas.android.com/apk/res/android">     
     <stroke          
            android:width="1dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="10px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>

While i am doing this all works well but in eclipse in GraphocalLayout i see the error message like below image.
enter image description here

Whats wrong in this ? And i want to remove this message then what should i have to do ?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

沫离伤花 2024-12-27 08:23:12

从头开始使用 Indigo 和 ADT 15,结果如下:

Eclipse capture

我通过 drawable/cornered_bg.xml 获得了该结果:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <stroke          
            android:width="10dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="100px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>
</shape>

和布局/main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/cornered_bg">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>

更改android:radius值确实有效......但是所有角都是圆角的(在真实设备上没问题)。

当然是图形布局的限制。我建议您搜索并浏览 http://code.google.com/p/android /issues/listhttp://tools.android.com/knownissues。我没有找到与此问题相关的任何内容,因此请尝试一下,如果没有找到任何内容,您可以开票。

With Indigo and ADT 15 from scratch, here is the result:

Eclipse capture

I obtain that with a drawable/cornered_bg.xml:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
    <stroke          
            android:width="10dip"          
            android:color="#ffffff"/>     
     <solid
            android:color="#95865F"/>
     <corners
            android:radius="100px"
            android:topRightRadius="0dp"
            android:bottomRightRadius="0dp" />
     <padding
            android:left="1dp"
            android:right="1dp"
            android:top="1dp"
            android:bottom="1dp"/>
</shape>

and a layout/main.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:background="@drawable/cornered_bg">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>

Changing the android:radius value does work… but all the corners are rounded (it's OK on a real device).

Certainly a limitation of the graphical layout. I suggest you to search and browse http://code.google.com/p/android/issues/list and http://tools.android.com/knownissues. I have found nothing related to this problem, so give it a try and if you find nothing, you could open a ticket.

南风起 2024-12-27 08:23:12

请尝试以下操作:

<?xml version="1.0" encoding="UTF-8"?> 
<corners
        android:topLeftRadius="10px"
        android:topRightRadius="0dp"
        android:bottomLeftRadius="10px"
        android:bottomRightRadius="0dp" />

Try the following:

<?xml version="1.0" encoding="UTF-8"?> 
<corners
        android:topLeftRadius="10px"
        android:topRightRadius="0dp"
        android:bottomLeftRadius="10px"
        android:bottomRightRadius="0dp" />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文