Skip to content

Commit b569792

Browse files
committed
demo
1 parent 09064dd commit b569792

File tree

12 files changed

+555
-27
lines changed

12 files changed

+555
-27
lines changed

app/src/main/assets/iconfont.ttf

4.16 KB
Binary file not shown.

app/src/main/java/com/study/xuan/easytextview/MainActivity.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.text.SpannableStringBuilder;
99
import android.text.Spanned;
1010
import android.text.style.ForegroundColorSpan;
11+
import android.text.style.StrikethroughSpan;
1112
import android.text.style.UnderlineSpan;
1213
import android.view.LayoutInflater;
1314
import android.view.View;
@@ -32,22 +33,23 @@ protected void onCreate(Bundle savedInstanceState) {
3233
super.onCreate(savedInstanceState);
3334
setContentView(R.layout.activity_main);
3435
textView = (EasyTextView) findViewById(R.id.easyText);
35-
SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
36+
/*SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
3637
stringBuilder.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
3738
SpannableStringBuilder insert = new SpannableStringBuilder("你好啊啊啊");
3839
insert.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
39-
stringBuilder.insert(0, insert);
40+
stringBuilder.insert(0, insert);*/
4041
/*TextView text = (TextView) findViewById(R.id.text);
4142
SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
4243
SpannableStringBuilder insert = new SpannableStringBuilder("你好啊啊啊");
4344
insert.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
4445
stringBuilder.insert(0, insert);
4546
text.setText(stringBuilder);*/
4647
//textView.setTextRight(insert);
47-
textView.setTextRight("啊啊啊啊");
48-
textView.addSpanLeft(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
49-
textView.spanRight(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
50-
.spanRight(new ForegroundColorSpan(Color.YELLOW), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
48+
textView.spanLeft(new UnderlineSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
49+
.spanLeft(new StrikethroughSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
50+
.spanLeft(new ForegroundColorSpan(Color.RED), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
51+
.spanRight(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
52+
.spanRight(new ForegroundColorSpan(Color.BLUE), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
5153
.build();
5254
textView.setOnClickListener(new View.OnClickListener() {
5355
@Override

0 commit comments

Comments
 (0)