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 9e5e993c79)
This commit is contained in:
@@ -335,7 +335,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
|
|||||||
backgroundView = backgroundLayout;
|
backgroundView = backgroundLayout;
|
||||||
backgroundLayout.setOrientation(LinearLayout.VERTICAL);
|
backgroundLayout.setOrientation(LinearLayout.VERTICAL);
|
||||||
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
|
||||||
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
LayoutParams.MATCH_PARENT, 0);
|
||||||
layoutParams.weight = 1;
|
layoutParams.weight = 1;
|
||||||
backgroundLayout.setLayoutParams(layoutParams);
|
backgroundLayout.setLayoutParams(layoutParams);
|
||||||
topLayout.addView(backgroundLayout);
|
topLayout.addView(backgroundLayout);
|
||||||
@@ -370,7 +370,7 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
|
|||||||
// content frame
|
// content frame
|
||||||
mContentRoot = new FrameLayout(context);
|
mContentRoot = new FrameLayout(context);
|
||||||
layoutParams = new LinearLayout.LayoutParams(
|
layoutParams = new LinearLayout.LayoutParams(
|
||||||
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
LayoutParams.MATCH_PARENT, 0);
|
||||||
layoutParams.weight = 1;
|
layoutParams.weight = 1;
|
||||||
mContentRoot.setLayoutParams(layoutParams);
|
mContentRoot.setLayoutParams(layoutParams);
|
||||||
backgroundLayout.addView(mContentRoot);
|
backgroundLayout.addView(mContentRoot);
|
||||||
|
|||||||
Reference in New Issue
Block a user