Skip to content

Commit e52dc65

Browse files
committed
1,修复bug
1 parent ca14f99 commit e52dc65

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,14 +382,19 @@ class FormatTextView : BaseTextView {
382382
bottom = gradientDrawText.rectF.top
383383
}
384384
}
385-
val mLinearGradient = formatText.gradient?.gradientColors?.let {
385+
val linearGradient = formatText.gradient?.gradientColors?.let {
386386
LinearGradient(
387387
left, top, right, bottom,
388388
it, formatText.gradient?.gradientPositions,
389389
Shader.TileMode.CLAMP
390390
)
391391
}
392-
ds.shader = mLinearGradient
392+
ds.shader = linearGradient
393+
//设置是否要下划线
394+
ds.isUnderlineText = userDefaultUnder && underline
395+
if (userDefaultDelete && deleteLine) {
396+
ds.flags = ds.flags or Paint.STRIKE_THRU_TEXT_FLAG
397+
}
393398
}
394399
}
395400
htmlBuilder.setSpan(clickableSpan, gradientDrawText.start, gradientDrawText.end, flags)

README-zh.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@ textView.setFormatTextBean("%1$s欢迎欢迎欢迎欢迎欢迎欢迎欢迎%3$s
203203

204204
那么下划线将采用绘制下划线方案,**underlineMarginTop**不设置(即为0)绘制在默认的删除线位置,如果设置数值过大并且文本长到换行,则需要设置行间距,否则会出现下滑线压在下一行的问题,你可通过设置lineSpacingExtra或lineSpacingMultiplier来解决问题
205205

206+
如果设置渐变色字体后 在您不设置 **underlineColor、underlineMarginTop、underlineWidth** 这3项的情况下,下划线也将会是渐变色的
207+
208+
### 删除线常见问题
209+
如果您设置了下划线以下样式:
210+
211+
**deleteLineColor、deleteLineWidth**
212+
213+
那么删除线将采用绘制删除线方案,如果设置渐变色字体后 在您不设置 **deleteLineColor、deleteLineWidth** 这2项的情况下,删除线也将会是渐变色的
214+
206215
### verticalAlignment 常见问题
207216

208217
ALIGN_CENTER 为当前库新增对齐方式旨解决在小图标和文本中心对齐问题,在图片设置超过行高时将会出现裁剪问题,如果您图片很大还是建议使用ALIGN_BASELINE

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,15 @@ If you set the following styles for underline:
205205

206206
Then the underline will be drawn in the underline scheme. **underlineMarginTop** is not set (ie 0) and drawn at the default strikethrough position. If the set value is too large and the text is long to a new line, you need to set the line spacing, otherwise there will be a glide line. The problem of pressing on the next line, you can solve the problem by setting lineSpacingExtra or lineSpacingMultiplier
207207

208+
If you set the gradient font and you do not set **underlineColor, underlineMarginTop, underlineWidth** these 3 items, the underline will also be gradient
209+
210+
### Strikethrough FAQ
211+
If you set the following styles for underline:
212+
213+
**deleteLineColor、deleteLineWidth**
214+
215+
Then the strikethrough will adopt the strikethrough scheme. If you set the gradient font and you do not set **deleteLineColor, deleteLineWidth**, the strikethrough will also be gradient
216+
208217
### verticalAlignment FAQ
209218

210219
ALIGN_CENTER adds an alignment method to the current library to solve the alignment problem in the center of small icons and text. When the image setting exceeds the line height, there will be a cropping problem. If your image is large, it is recommended to use ALIGN_BASELINE

0 commit comments

Comments
 (0)