diff options
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java index 4aa2095301e4..50b32f9c123a 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java @@ -156,19 +156,19 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView } setLayoutTransition(transitioner); - // Scroll to end after layout. - final ViewTreeObserver observer = getViewTreeObserver(); + // Scroll to end after initial layout. final OnGlobalLayoutListener updateScroll = new OnGlobalLayoutListener() { public void onGlobalLayout() { mLastScrollPosition = scrollPositionOfMostRecent(); scrollTo(mLastScrollPosition, 0); + final ViewTreeObserver observer = getViewTreeObserver(); if (observer.isAlive()) { observer.removeOnGlobalLayoutListener(this); } } }; - observer.addOnGlobalLayoutListener(updateScroll); + getViewTreeObserver().addOnGlobalLayoutListener(updateScroll); } @Override |