I mean something like:
<string name="error" color="#9a1d1d">Error!</string>
Android TextView – Text Color. TextView Text Color – To change the color of text in TextView, you can set the color in layout XML file using textColor attribute or change the color dynamically in Kotlin file using setTextColor() method.
As suggested by rekire not possible to set color the way you are doing.
You can use the method as suggested by rekire.
In you xml you can specify color for your textview as
android:textColor="#0EFFFF"
You can also set text color programaticaly
TextView tv= (TextView)findviewById(R.id.textView1);
tv.setTextColor(Color.RED);
To set color of particular words in textview, you can use spannable string
TextView tv= (TextView)findviewById(R.id.textView1);
tv.setText("");
String s="Hello World";
SpannableString ss= new SpannableString(s);
ss.setSpan(new ForegroundColorSpan(Color.GREEN), 0, 5, 0);
tv.setText(ss);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With