尝试用LayerList来定义背景,定义如下:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <bitmap android:src="@drawable/background_tile" android:tileMode="repeat" /> </item> <item> <bitmap android:src="@drawable/background_cover" /> </item> </layer-list>
其中background_cover所指向的resource为xml drawable,这将导致application crash,如果换成一般的image drawable则不会出现该问题。
得出结论应该是:<bitmap>的src不允许为xml drawables,原因可能是为了避免循环引用(待查)
相关的sites:
http://stackoverflow.com/questions/9788726/using-drawable-resources