Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2b34c96 authored by Deepanshu Gupta's avatar Deepanshu Gupta
Browse files

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 5712b5fc)
parent e183855c
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -312,7 +312,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);
@@ -347,7 +347,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);