7C00.ME/houmu 2012-10-28

android-selector的不能是空节点

一个可用的例子:

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

    <item android:state_pressed="true"><shape android:shape="rectangle">
            <solid android:color="@color/grey_light" />

            <stroke android:width="1dp" android:color="#00000000" />
        </shape></item>

</selector>

如果改成这样:

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

    <item android:state_pressed="true"><shape android:shape="rectangle">
            <solid android:color="@color/grey_light" />

            <stroke android:width="1dp" android:color="#00000000" />
        </shape></item>
    <item android:state_pressed="false"></item>
</selector>

一旦使用,Activity可能会无法启动!