Android EditText change color of a single word -
how go changing color of single word in edittext ? meaning words 1 time color , 1 single word different color.
kind regards
use foregroundcolorspan
spannablestringbuilder ssb = new spannablestringbuilder(yourtext); foregroundcolorspan colorspan = new foregroundcolorspan( context.getresources() // specify color .getcolor(r.color.your_font_color)); realprice.setspan(colorspan, 0, // start index of single word 1, // end index of single word spanned.span_exclusive_inclusive); youredittext.settext(ssb);
android
No comments:
Post a Comment