From 0ff3efe8a2df37a6cfa7ae2ef0164f233c153090 Mon Sep 17 00:00:00 2001 From: tianxiangyu <96164429+FlyJingFish@users.noreply.github.com> Date: Fri, 20 Oct 2023 18:37:30 +0800 Subject: [PATCH] =?UTF-8?q?1=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=B5=8B=E9=87=8F?= =?UTF-8?q?=E5=AE=BD=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flyjingfish/gradienttextviewlib/GradientTextView.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/com/flyjingfish/gradienttextviewlib/GradientTextView.java b/library/src/main/java/com/flyjingfish/gradienttextviewlib/GradientTextView.java index 5b2d0cd..dba89dd 100644 --- a/library/src/main/java/com/flyjingfish/gradienttextviewlib/GradientTextView.java +++ b/library/src/main/java/com/flyjingfish/gradienttextviewlib/GradientTextView.java @@ -129,17 +129,14 @@ static CharSequence createIndentedText(CharSequence text, int marginFirstLine, i @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - int widthMode = MeasureSpec.getMode(widthMeasureSpec); super.onMeasure(widthMeasureSpec, heightMeasureSpec); + int widthMode = MeasureSpec.getMode(widthMeasureSpec); if (widthMode == MeasureSpec.AT_MOST && strokeWidth > 0){ int measureWidth = getMeasuredWidth(); int width = MeasureSpec.getSize(widthMeasureSpec); if (measureWidth < width){ int measureHeight = getMeasuredHeight(); -// int height = MeasureSpec.getSize(heightMeasureSpec); - int heightMode = MeasureSpec.getMode(heightMeasureSpec); - int newWidth = MeasureSpec.makeMeasureSpec(measureWidth+Math.min(strokeWidth/2,width-measureWidth), widthMode); - setMeasuredDimension(newWidth,MeasureSpec.makeMeasureSpec(measureHeight, heightMode)); + setMeasuredDimension(measureWidth+Math.min(strokeWidth/2,width-measureWidth),measureHeight); } } }