Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android XML可绘制don';使用图层列表无法正常工作_Android_Xml - Fatal编程技术网

Android XML可绘制don';使用图层列表无法正常工作

Android XML可绘制don';使用图层列表无法正常工作,android,xml,Android,Xml,当我使用图层列表处理XML可绘制文件时,它不会出现在预览中,也不会作为元素的背景(尤其是旋转器) 可绘制XML列表: 如何修复?关于…答案可能比你想象的要简单: 不能使用“-”作为文件资源名称。文件资源名称应仅包含小写a-z、0-9或下划线 只需将@drawable/down arrow资源重命名为@drawable/down_arrow(重命名源图像文件) <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:a

当我使用图层列表处理XML可绘制文件时,它不会出现在预览中,也不会作为元素的背景(尤其是旋转器)

可绘制XML列表:



如何修复?关于…

答案可能比你想象的要简单:

不能使用“-”作为文件资源名称。文件资源名称应仅包含小写a-z、0-9或下划线

只需将
@drawable/down arrow
资源重命名为
@drawable/down_arrow
(重命名源图像文件)

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:layout_height="wrap_content" android:shape="rectangle">
            <solid android:color="#f3f4f6"></solid>
            <size android:width="500px" android:height="100px"></size>
            <corners android:radius="35px"></corners>
        </shape>
    </item>
    <item>
        <bitmap android:src="@drawable/down-arrow" android:gravity="center|right"></bitmap>
    </item>
</layer-list>