android 如何给TextView中的文字描边让文字和文字边线的颜色不同

android 如何给TextView中的文字描边让文字和文字边线的颜色不同

参考
textView = TextView findViewByIdR.id.textview;
SpannableStringBuilder builder = new SpannableStringBuildertextView.getText.toString;

//ForegroundColorSpan 为文字前景色,BackgroundColorSpan为文字背景色
ForegroundColorSpan redSpan = new ForegroundColorSpanColor.RED;
ForegroundColorSpan whiteSpan = new ForegroundColorSpanColor.WHITE;
ForegroundColorSpan blueSpan = new ForegroundColorSpanColor.BLUE;
ForegroundColorSpan greenSpan = new ForegroundColorSpanColor.GREEN;
ForegroundColorSpan yellowSpan = new ForegroundColorSpanColor.YELLOW;

builder.setSpanredSpan, 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE;
builder.setSpanwhiteSpan, 1, 2, Spannable.SPAN_INCLUSIVE_INCLUSIVE;
builder.setSpanblueSpan, 2, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE;
builder.setSpangreenSpan, 3, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE;
builder.setSpanyellowSpan, 4,5, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE;

textView.setTextbuilder;

发表评论

电子邮件地址不会被公开。 必填项已用*标注