I mean something like:
Error!
i hope this help for you.
TextView textView=findViewById(R.id.text);
String error= getResources().getString(R.string.error);
ForegroundColorSpan fgColor=new ForegroundColorSpan(Color.RED); // here set the color of Text
SpannableString ss=new SpannableString(error); //here set the text to spannableString
ss.setSpan(fgColor,0,error.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); //here which color , when to where you will set the color
textView.setText(ss);
What is SpannableString in android ?
Android SpannableString Example. The SpannableString in android is an excellent way to style strings in a TextView. Put simply, it allows a TextView to provide different styles to different areas of text.