<?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"> <corners android:radius="5dp" /> <stroke android:width="1dp" android:color="@color/mars__default_divider_color" /> <solid android:color="#c0c0c0" /> </shape> </item> <item> <shape android:shape="rectangle"> <corners android:radius="5dp" /> <stroke android:width="1dp" android:color="@color/mars__default_divider_color" /> </shape> </item> </selector>
如果 默认的 item 写在最上面, 会导致state_pressed="true" 状态无法触发, 需要 写到最下面, 或者 把默认的写成"false”