OSDN Git Service

Optimize list view scrolls
authorRomain Guy <romainguy@google.com>
Tue, 7 May 2013 01:42:08 +0000 (18:42 -0700)
committerRomain Guy <romainguy@google.com>
Tue, 7 May 2013 01:42:08 +0000 (18:42 -0700)
Bug #8108706

Change-Id: I8679b584132e82b7bb3301a38800de4ddfc57be6

core/java/android/view/ViewGroup.java

index 58c30e9..1fef0a2 100644 (file)
@@ -4486,16 +4486,21 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     public void offsetChildrenTopAndBottom(int offset) {
         final int count = mChildrenCount;
         final View[] children = mChildren;
+        boolean invalidate = false;
 
         for (int i = 0; i < count; i++) {
             final View v = children[i];
             v.mTop += offset;
             v.mBottom += offset;
             if (v.mDisplayList != null) {
+                invalidate = true;
                 v.mDisplayList.offsetTopAndBottom(offset);
-                invalidateViewProperty(false, false);
             }
         }
+
+        if (invalidate) {
+            invalidateViewProperty(false, false);
+        }
     }
 
     /**