-
How to show single textview in different color?
over 7 years ago
-
over 7 years ago
You can use the following code:-
In your casestartIndex is 0 andendIndex is 9TextView TV = (TextView)findViewById(R.id.mytextview01); Spannable wordtoSpan = new SpannableString("your string"); wordtoSpan.setSpan(new ForegroundColorSpan(Color.RED), startIndex, EndIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); TV.setText(wordtoSpan);
-
1 Answer(s)