android - ListView How to clear selection -
so have selector on list view, each row has 2 text views
, each text view has selector in sync(different drawables same states: activated
, pressed
) 1 on list. logic when detect fling on item in list view, temporarily change background color of view , after 500ms set transparent.
but, when resets child view has pressed state set true , not either ways view has correct bg inner text views
correspond activated drawables
when pressed state false.
i can't seem figure out how correct behavior. appreciated, thing driving me nuts.
i've tried clearing choices doesn't help, i've tried explicitly force child view set false activated state , pressed state doesn't goo either. i've run out of options this.
so after spending time analyzing going on behind scenes in abslistview
found workaround problem. first more on problem causing this, abslistview
has got 8 states motion detection namely -
- touch_mode_rest (-1)
- touch_mode_down (0)
- touch_mode_tap (1)
- touch_mode_done_waiting (2)
- touch_mode_scroll (3)
- touch_mode_fling (4)
- touch_mode_overscroll (5)
- touch_mode_overfling (6)
and when action_up
event being dispatched list view somehow touchmode
getting stuck between (2) , (5) causing remember pressed state on motionview(child view)
causing incorrect results i.e. pressed state visible when motion had finished.
i couldn't clarity on why issue there in first place dispatching event touchlistener
listview
.
anyhow work around such cases -
when gesturedetector
recognizes gesture return true had when gesturedetector
returns true change motionevent
's action action_cancel
, dispatch listview
, voila, problem solved.
Comments
Post a Comment