Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void onCreate(Bundle savedInstanceState) {
.append("正常")
.append(new SpecialLabelUnit("原创", Color.RED, sp2px(10), Color.TRANSPARENT).showBorder(Color.BLACK, 2).setPadding(5).setPaddingLeft(10).setPaddingRight(10).setGravity(SpecialGravity.TOP))
.append("正常")
.append(new SpecialLabelUnit("原创", Color.RED, sp2px(10), Color.TRANSPARENT).showBorder(Color.BLACK, 2).setPadding(5).setPaddingLeft(10).setPaddingRight(10).setGravity(SpecialGravity.CENTER));
.append(new SpecialLabelUnit("原创", Color.RED, sp2px(10), Color.TRANSPARENT).showStrikeThrough().showBorder(Color.BLACK, 2).setPadding(5).setPaddingLeft(10).setPaddingRight(10).setGravity(SpecialGravity.CENTER));
tvText11.setText(simplifySpanBuild11.build());

SimplifySpanBuild simplifySpanBuild2 = new SimplifySpanBuild("替换所有张字的颜色及字体大小并加粗,张歆艺、张馨予、张嘉倪、张涵予、张含韵、张韶涵、张嘉译、张佳宁、大张伟", new SpecialTextUnit("张").useTextBold().setTextSize(20).setTextColor(0xFFFFA500).setConvertMode(SpecialConvertMode.ALL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void draw(Canvas canvas, CharSequence text, int start, int end, float x,

if (mSpecialLabelUnit.isTextItalic())
paint.setTypeface(Typeface.create((String) null, Typeface.ITALIC));

paint.setStrikeThruText(mSpecialLabelUnit.isShowStrikeThrough());
canvas.drawText(mSpecialText, newTextX, newTextY, paint);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class SpecialLabelUnit extends BaseSpecialUnit {
private boolean isTextBold;
private boolean isTextItalic;
private boolean isClickable;
private boolean isShowStrikeThrough;
private int bgColor;

/**
Expand Down Expand Up @@ -261,4 +262,22 @@ public int getTextStyle() {
}



/**
* Show StrikeThrough
*
* @return SpecialTextUnit
*/
public SpecialLabelUnit showStrikeThrough() {
isShowStrikeThrough = true;
return this;
}


public boolean isShowStrikeThrough() {
return isShowStrikeThrough;
}



}