我制作了一个包含图像和textview的自定义列表.在设置样式时,选择器不可见.使用setTheme(R.style.rose)调用该样式; 在创建Listactivity的方法作为第一个调用.但是,如果没有使用颜色作为背景(或注释样式中的背景线),则橙色选择器可见.但不是在背景的时候
listSelector
<item android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/list_selector_background_transition" />
<item android:state_pressed="true"
android:drawable="@drawable/list_selector_background_pressed" />
<item android:state_focused="true"
android:drawable="@drawable/list_selector_background_focus" />
Run Code Online (Sandbox Code Playgroud)
样式
<style name="rose">
<item name="android:textColor">@color/pink</item>
<item name="android:background">@color/rose</item>
<item name="android:cacheColorHint">@color/rose</item>
<item name="android:listSelector">@drawable/listitem_selector</item>
</style>
Run Code Online (Sandbox Code Playgroud)