Android的列表项重点亘古不留onItemLongclickListener亘古、不留、重点、列表

2023-09-06 23:22:27 作者:漸莣那傷

我有一个列表视图项严重的问题。我的要求是当我的长上点击列表项或拖动列表项重点应该留下来。目前我使用下面的选择器列表项。但它不是给我的预期结果,并将焦点迷路

I have serious problem with listview item. My requirement is When I am long clicking on list item or dragging on list item the focus should stay. Currently I am using the following selector for list item. But It is not giving me the expected result and the focus is getting lost

<item android:state_pressed="true"
        android:drawable="@drawable/detail_btn_frame_select" /> 
<item android:state_selected="true" 
        android:drawable="@drawable/detail_btn_frame_select" />
<item android:state_focused="true"
    android:drawable="@drawable/detail_btn_frame_select" />
 //Default
 <item
        android:drawable="@drawable/detail_btn_frame_norm" />

请做此帮助

推荐答案

试试这个,

android:state_focused="true" 

在您选择的XML