Force all views to relayout when ViewRoot is resized.
Bug #2519590
Change-Id: Ia6b9d4cf6d719f713703a1eb2e1ccdd5d61a5123
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index c87ffee..9df8ac3 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -1675,6 +1675,16 @@
return (theParent instanceof ViewGroup) && isViewDescendantOf((View) theParent, parent);
}
+ private static void forceLayout(View view) {
+ view.forceLayout();
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+ final int count = group.getChildCount();
+ for (int i = 0; i < count; i++) {
+ forceLayout(group.getChildAt(i));
+ }
+ }
+ }
public final static int DO_TRAVERSAL = 1000;
public final static int DIE = 1001;
@@ -1862,6 +1872,10 @@
if (msg.what == RESIZED_REPORT) {
mReportNextDraw = true;
}
+
+ if (mView != null) {
+ forceLayout(mView);
+ }
requestLayout();
}
break;