[3.3.0] TextView走马灯getLayout()为空异常处理

This commit is contained in:
wangmingjun
2023-06-20 10:58:35 +08:00
parent f335362e98
commit 2acad166dd

View File

@@ -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;