Selector, in listview (swipe-listview) row, stays in state pressed after re-instanciating the adapter

三世轮回 提交于 2019-12-04 16:55:11

The issue you are facing has been reported here https://github.com/47deg/android-swipelistview/issues/41.

As per the cooment by @strgev in that thread, the fix is to -

edit class SwipeListViewTouchListener by adding the line below to onTouch method:

....
case MotionEvent.ACTION_UP: {
view.onTouchEvent(motionEvent);
...

can you try that?

Try with clearChoices and notifyDataSetChanged:

yourListView.clearChoices();
yourListView.getAdapter().notifyDataSetChanged();

It may be a mutate problem. Try to assign the background to the row programmatically by first calling mutate() on the drawable.

First, obtain a Drawable instance from your custom selector-drawable, then invoke mutate() on it and finally assign the drawable as row's background:

Drawable selector = getResources().getDrawable(R.drawable.your_selector)
selector.mutate();
//...
row.setBackground(selector);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!