I have a listview that use a GestureDetector to handle swipe left. For each item, layout like below:
[FrameLayout]
[LinearLayout] hidden_menu [/LinearLayout]
[LinearLayout] main_layout [/LinearLayout]
[/FrameLayout]
, it will handle onTouchListener. When I move the main_layout to right, the hidden_menu will be shown [sample image]. When move other item to right, or moveUP or moveDOWN listview, I will hide the hidden_menu of the old (or opened) item using ObjectAnimator (x) and at the end Animation I called the main_layout.invalidate().
My problem is when scroll listview, it will reuse the row layout with ViewHolder pattern, so the new row is wrong layout (some hidden_layout is visibled).
1) Any ideas to refresh the new item when getView() is called?
2) Or how to refresh the animated item like the first time
I hope you guys can understand me !
Thanks and best regards!
I found the solution in my case:
if(holder.mHiddenMenu.getLeft() != 0) {
holder.mHiddenMenu.setTranslationX(0);
}