Skip to content

Commit

Permalink
demo
Browse files Browse the repository at this point in the history
  • Loading branch information
DrownCoder committed Apr 28, 2018
1 parent 09064dd commit b569792
Show file tree
Hide file tree
Showing 12 changed files with 555 additions and 27 deletions.
Binary file added app/src/main/assets/iconfont.ttf
Binary file not shown.
14 changes: 8 additions & 6 deletions app/src/main/java/com/study/xuan/easytextview/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.UnderlineSpan;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -32,22 +33,23 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (EasyTextView) findViewById(R.id.easyText);
SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
/*SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
stringBuilder.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
SpannableStringBuilder insert = new SpannableStringBuilder("你好啊啊啊");
insert.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
stringBuilder.insert(0, insert);
stringBuilder.insert(0, insert);*/
/*TextView text = (TextView) findViewById(R.id.text);
SpannableStringBuilder stringBuilder = new SpannableStringBuilder("呵呵呵呵呵");
SpannableStringBuilder insert = new SpannableStringBuilder("你好啊啊啊");
insert.setSpan(new UnderlineSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
stringBuilder.insert(0, insert);
text.setText(stringBuilder);*/
//textView.setTextRight(insert);
textView.setTextRight("啊啊啊啊");
textView.addSpanLeft(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
textView.spanRight(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.spanRight(new ForegroundColorSpan(Color.YELLOW), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
textView.spanLeft(new UnderlineSpan(), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.spanLeft(new StrikethroughSpan(), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.spanLeft(new ForegroundColorSpan(Color.RED), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.spanRight(new ForegroundColorSpan(Color.RED), 0, 1, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.spanRight(new ForegroundColorSpan(Color.BLUE), 1, 2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
.build();
textView.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Loading

0 comments on commit b569792

Please # to comment.