From a2b34c96f1ef24d96854d1e23426dec7774510e8 Mon Sep 17 00:00:00 2001 From: Deepanshu Gupta Date: Mon, 20 Jan 2014 17:02:37 -0800 Subject: 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 5712b5fc3fec0dc376e84f660f2fe0d1102c0cbb) --- .../src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index 7169db3ed98d..f8f348c6afa2 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -312,7 +312,7 @@ public class RenderSessionImpl extends RenderAction { 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 { // 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); -- cgit v1.2.3-59-g8ed1b