From b4b8740aed4753152729f1630b4241dedcadc98d Mon Sep 17 00:00:00 2001 From: Siyamed Sinir Date: Thu, 5 May 2016 16:48:47 -0700 Subject: [PATCH] Request re-layout after setText if layout width is 0 When TextView is in a layout with weight params (i.e. LinearLayout) and the width is set to 0, do not try to prevent requestLayout. Bug: 27995311 Change-Id: I6f98f0ac8260bfa98147157f5b73e87308c7efab --- core/java/android/widget/TextView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a0843c7a8be4..26697f97d48c 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -7311,7 +7311,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // If we have a fixed width, we can just swap in a new text layout // if the text height stays the same or if the view height is fixed. - if ((mLayoutParams.width != LayoutParams.WRAP_CONTENT || + if (((mLayoutParams.width != LayoutParams.WRAP_CONTENT && mLayoutParams.width != 0) || (mMaxWidthMode == mMinWidthMode && mMaxWidth == mMinWidth)) && (mHint == null || mHintLayout != null) && (mRight - mLeft - getCompoundPaddingLeft() - getCompoundPaddingRight() > 0)) { -- 2.11.0