【问题标题】:Could not find schema information for the element 'shape'找不到元素“形状”的架构信息
【发布时间】:2017-10-03 02:25:44
【问题描述】:

我有一个用于自定义 EditText 布局的自定义 xml。但我总是有这样的消息:

这是我的自定义 EditText 布局代码:

<?xml version="1.0" encoding="utf-8" ?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
  <shape xmlns:android="http://schemas.android.com/apk/res/android"

       android:thickness="0dp"

       android:shape="rectangle">
    <stroke android:width="3dp"

           android:color="#4799E8"/>
    <corners android:radius="5dp" />
    <gradient

     android:startColor="#C8C8C8"

     android:endColor="#FFFFFF"

     android:type="linear"

     android:angle="270"/>
  </shape>
</set>

【问题讨论】:

    标签: android xml xamarin.android


    【解决方案1】:

    在您的代码中使用它。

    <?xml version="1.0" encoding="utf-8" ?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:thickness="0dp"
       android:shape="rectangle">
    
    <stroke android:width="3dp"
           android:color="#4799E8"/>
    <corners android:radius="5dp" />
    
    <gradient
     android:startColor="#C8C8C8"
     android:endColor="#FFFFFF"
     android:type="linear"
     android:angle="270"/>
    </shape>
    

    删除代码中的 set 标签。

    注意

    你应该在drawable目录中添加shape xml代码。

    编辑

    删除项目视图中的inputText.xml,然后作为android应用重新运行。

    然后更新inputText.xml

    【讨论】:

    • 还是一样。这是屏幕截图:drive.google.com/file/d/0B_NWI7w3lXlfSW0wM1BXX3hqZ1U/…
    • @Kmmp 你把xml添加到drawable目录了吗?
    • @ElvisXia-MSFT 是的
    • @Kmmp 好吧,当我将inputText.xml 放入可绘制文件夹时,我无法收到错误消息,请确保从其他文件夹中删除以前的 xml 文件并尝试重建解决方案。跨度>
    猜你喜欢
    • 2012-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-20
    • 2013-11-29
    • 2017-09-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多