I make a swipe gesture and track it from dispatchTouchEvent in a ScrollView. However, end of the swipe gesture is being detected one frame later. See the last two events below, last two gestures are ACTION_MOVE and ACTION_UP. But their touch points are exactly the same, however their eventTimes are different.
action=ACTION_MOVE, x[0]=734.165, y[0]=1241.4056, historySize=2, eventTime=136103401 action=ACTION_ MOVE , x[0]= 747.8897 , y[0]= 1077.508 , historySize=2, eventTime= 136103418 action=ACTION_ UP , x[0]= 747.8897 , y[0]= 1077.508 , historySize=0, eventTime= 136103432
136103432 - 136103418 = 14. So ACTION_UP is being retrieved 14 ms later. This is preventing some smooth effects I do right after finger leaves the screen.
You can check the full log from here: https://zerobin.net/?a71539bf3862abdb#xXjCPrjk/Fi7l+N++9oivQkieFRQ3KA6gwQ0pU2NTYc=
So, how can I detect ACTION_UP earlier in dispatchTouchEvent?
You can't detect ACTION_UP until it happens. The user could leave their finger on the screen for several seconds so you may want to rethink your design
此问题已在 Android P 中修复。看起来 Google 决定进行一些真正的 UI 动画改进。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.