Commit eb9984b
committed
Avoid views flickering when interrupting a scroll
If you start a new scroll while the scroll animation is in progress,
onInterceptTouchEvent will call mScroller.abortAnimation,
and when computeScroll is next called, postViewSwitched will run.
As computeScroll is called within View.draw, this is not a good time
to be fiddling with the layout by adding and removing children. It
causes the wrong view to be drawn for a frame when this happens.
Instead of calling postViewSwitched immediately,
I've changed it to be posted to the handler so it will be called
after this frame has finished drawing and before the next is laid out.1 parent 97740a6 commit eb9984b
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
502 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
503 | 507 | | |
504 | 508 | | |
505 | 509 | | |
| |||
0 commit comments