需求:默认透明,选中一个图片,获得焦点另一张图片
<ListView
android:id="@+id/second_fliter"
android:layout_width="147dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/voice_search_voice_head_marginLeft"
android:layout_marginRight="@dimen/voice_search_voice_head_marginLeft"
android:layout_marginTop="@dimen/activity_search_keyboard_layout_marginTop"
android:listSelector="@android:color/transparent"
android:choiceMode="singleChoice"
android:visibility="gone" />
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@drawable/search_filter_listitem_focused" />
<item android:state_activated="true" android:drawable="@drawable/search_filter_listitem_normal"/>
<item android:drawable="@android:color/transparent" />
</selector>
最后将selector设置到item布局的background上