diff options
author | Dianne Hackborn <hackbod@google.com> | 2010-12-02 21:48:53 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2010-12-03 10:46:18 -0800 |
commit | 189ee18d6c6483ad63cc864267328259e2e00b95 (patch) | |
tree | 77ad8233f7fa19a13fcb2c2d0df80de42fac69a2 /core/java/android/widget/FrameLayout.java | |
parent | 32820249adbcacb7a7a1d35f22a892badda03f3e (diff) | |
download | frameworks_base-189ee18d6c6483ad63cc864267328259e2e00b95.zip frameworks_base-189ee18d6c6483ad63cc864267328259e2e00b95.tar.gz frameworks_base-189ee18d6c6483ad63cc864267328259e2e00b95.tar.bz2 |
Implement smarter sizing of WRAP_CONTENT windows.
This extends the view hierarchy's measure pass to allow view to
propagate up to their parent additional information besides just
their measured size. They can now report that their measured width
and/or height should be larger than the size their parent is
limiting them to (even though by definition they need to contrain
their reported measurements to the limits imposed by the parent).
ViewRoot uses this information to determine if it should remeasure
the window with a larger size limit to try to make it fit.
Change-Id: I90af3b7a8ec45d0a5c003fb009857025209d83eb
Diffstat (limited to 'core/java/android/widget/FrameLayout.java')
-rw-r--r-- | core/java/android/widget/FrameLayout.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index bcab7a9..940fec1 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -248,6 +248,7 @@ public class FrameLayout extends ViewGroup { int maxHeight = 0; int maxWidth = 0; + int childState = 0; // Find rightmost and bottommost child for (int i = 0; i < count; i++) { @@ -256,6 +257,7 @@ public class FrameLayout extends ViewGroup { measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); maxWidth = Math.max(maxWidth, child.getMeasuredWidth()); maxHeight = Math.max(maxHeight, child.getMeasuredHeight()); + childState = combineMeasuredStates(childState, child.getMeasuredState()); } } @@ -274,8 +276,9 @@ public class FrameLayout extends ViewGroup { maxWidth = Math.max(maxWidth, drawable.getMinimumWidth()); } - setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec), - resolveSize(maxHeight, heightMeasureSpec)); + setMeasuredDimension(resolveSizeAndState(maxWidth, widthMeasureSpec, childState), + resolveSizeAndState(maxHeight, heightMeasureSpec, + childState<<MEASURED_HEIGHT_STATE_SHIFT)); } /** |