Optimize layout rendering in layoutlib [DO NOT MERGE]

The height of a layout should be zero if it is assigned a layout_weight.
This way, the layout is measured only once and prevents spurious errors.

Bug: https://code.google.com/p/android/issues/detail?id=58398
Change-Id: If49a7480e5eb82cb86780e00f2f5b65ee053fc2a
(cherry-picked from 5712b5fc3f)
This commit is contained in:
Deepanshu Gupta
2014-01-20 17:02:37 -08:00
parent e183855c1e
commit a2b34c96f1

View File

@@ -312,7 +312,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
backgroundView = backgroundLayout;
backgroundLayout.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
LayoutParams.MATCH_PARENT, 0);
layoutParams.weight = 1;
backgroundLayout.setLayoutParams(layoutParams);
topLayout.addView(backgroundLayout);
@@ -347,7 +347,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
// content frame
mContentRoot = new FrameLayout(context);
layoutParams = new LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
LayoutParams.MATCH_PARENT, 0);
layoutParams.weight = 1;
mContentRoot.setLayoutParams(layoutParams);
backgroundLayout.addView(mContentRoot);