如下:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="false" > <shape> <solid android:color="#ffffff"/> <stroke android:color="#888" /> <corners android:radius="3dp"/> </shape> </item> <item android:state_pressed="true"> <shape> <solid android:color="#dddddd"></solid> <stroke android:color="#888" /> <corners android:radius="3dp"/> </shape> </item> </selector>
原因:stroke没有设置宽度
解决方案:
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_pressed="false" > <shape> <solid android:color="#ffffff"/> <stroke android:color="#888" android:width="1px"/> <corners android:radius="3dp"/> </shape> </item> <item android:state_pressed="true"> <shape> <solid android:color="#dddddd"></solid> <stroke android:color="#888" android:width="1px"/> <corners android:radius="3dp"/> </shape> </item> </selector>
时间: 2024-10-02 19:08:09