When I (long)click an item in my ListView, some list items change their heights (as intended) and the clicked item suddenly moves (sometimes even out of view). How can I keep it under my finger?
By using list.smoothScrollToPosition(), I can only choose which item (by index) will be the topmost visible one.
view.setTop() (in pixels) doesn't seem to do anything.
I also tried list.smoothScrollByOffset() (in pixels), but then I need to know how much my item has moved. But unfortunately view.getTop() before redrawing is the same as view.getTop() after redrawing.
Any idea?
list.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
// some action changing the height of some list items
notifyDataSetChanged();
// How to bring the clicked list item back under my finger?
return true;
}
});