diff --git a/FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt b/FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt index ff6b742..210ff55 100644 --- a/FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt +++ b/FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt @@ -382,14 +382,19 @@ class FormatTextView : BaseTextView { bottom = gradientDrawText.rectF.top } } - val mLinearGradient = formatText.gradient?.gradientColors?.let { + val linearGradient = formatText.gradient?.gradientColors?.let { LinearGradient( left, top, right, bottom, it, formatText.gradient?.gradientPositions, Shader.TileMode.CLAMP ) } - ds.shader = mLinearGradient + ds.shader = linearGradient + //设置是否要下划线 + ds.isUnderlineText = userDefaultUnder && underline + if (userDefaultDelete && deleteLine) { + ds.flags = ds.flags or Paint.STRIKE_THRU_TEXT_FLAG + } } } htmlBuilder.setSpan(clickableSpan, gradientDrawText.start, gradientDrawText.end, flags) diff --git a/README-zh.md b/README-zh.md index 150e8ab..d235209 100644 --- a/README-zh.md +++ b/README-zh.md @@ -203,6 +203,15 @@ textView.setFormatTextBean("%1$s欢迎欢迎欢迎欢迎欢迎欢迎欢迎%3$s 那么下划线将采用绘制下划线方案,**underlineMarginTop**不设置(即为0)绘制在默认的删除线位置,如果设置数值过大并且文本长到换行,则需要设置行间距,否则会出现下滑线压在下一行的问题,你可通过设置lineSpacingExtra或lineSpacingMultiplier来解决问题 +如果设置渐变色字体后 在您不设置 **underlineColor、underlineMarginTop、underlineWidth** 这3项的情况下,下划线也将会是渐变色的 + +### 删除线常见问题 +如果您设置了下划线以下样式: + +**deleteLineColor、deleteLineWidth** + +那么删除线将采用绘制删除线方案,如果设置渐变色字体后 在您不设置 **deleteLineColor、deleteLineWidth** 这2项的情况下,删除线也将会是渐变色的 + ### verticalAlignment 常见问题 ALIGN_CENTER 为当前库新增对齐方式旨解决在小图标和文本中心对齐问题,在图片设置超过行高时将会出现裁剪问题,如果您图片很大还是建议使用ALIGN_BASELINE diff --git a/README.md b/README.md index a1c979e..c6453c6 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,15 @@ If you set the following styles for underline: 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 +If you set the gradient font and you do not set **underlineColor, underlineMarginTop, underlineWidth** these 3 items, the underline will also be gradient + +### Strikethrough FAQ +If you set the following styles for underline: + +**deleteLineColor、deleteLineWidth** + +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 + ### verticalAlignment FAQ 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