From 2acad166ddd7fa00882182d4627e0a956c2b24ca Mon Sep 17 00:00:00 2001 From: wangmingjun Date: Tue, 20 Jun 2023 10:58:35 +0800 Subject: [PATCH] =?UTF-8?q?[3.3.0]=20TextView=E8=B5=B0=E9=A9=AC=E7=81=AFge?= =?UTF-8?q?tLayout()=E4=B8=BA=E7=A9=BA=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mogo/och/common/module/wigets/MarqueeTextView.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/MarqueeTextView.java b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/MarqueeTextView.java index 8b141d5ded..bd549f2888 100644 --- a/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/MarqueeTextView.java +++ b/OCH/mogo-och-common-module/src/main/java/com/mogo/och/common/module/wigets/MarqueeTextView.java @@ -105,6 +105,9 @@ public class MarqueeTextView extends androidx.appcompat.widget.AppCompatTextView } final int textWidth = getWidth() - getCompoundPaddingLeft() - getCompoundPaddingRight(); + + if (getLayout() == null) return; + final float lineWidth = getLayout().getLineWidth(0); final float gap = mCustomGap*textWidth; float ghostStart = lineWidth - textWidth + gap;