From 9e5e993c7969ad60ff70cfdcf707247f38a705a1 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 35d56c0d67537e56fafebd8edf790026644fe8de) --- .../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 9ddbbf140df4..7e09195acf7c 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 @@ -335,7 +335,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); @@ -370,7 +370,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