Android XML元素不允许使用。

7
我有以下XML布局,基本上给我提供了EditText的圆角。为什么Android检查器说solid元素不允许在这里,而且corners元素不允许在这里
它可以正常工作,我应该保留它吗?
<?xml version="1.0" encoding="utf-8"?>    
<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle" android:padding="10dp"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
    <solid android:color="#FFFFFF" />
    <corners
        android:bottomRightRadius="5dp"
        android:bottomLeftRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp" />
</shape>
1个回答

10

XML 文件应该位于 res/drawable 目录下。如果它被放置在 res/layout 目录下,则是错误的位置。


太简单了,但我就是想不明白为什么它会这么说。完美地运行着。谢谢你的指点 :) 一旦可以,我会标记为正确答案。 - Phil

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接