In the string.xml file i use the following tag
<string name="CodeColor" >"#0000ff"</string>
If I use
textview1.setTextColor(Color.RED);
it works, but when I use
textview1.setTextColor(TextViewStyles.this.getResources().getColor(R.string.CodeColor));
or
textview1.setTextColor(R.string.CodeColor);
it doen't work. Any suggestions...
Thanks in Advance
You can use
textView1.setTextColor(getResources().getColor(R.color.mycolor))
or
textview1.setBackgroundColor(Color.parseColor("#ffffff"));
or
textview1.setBackgroundColor(Color.RED);
or
textView1.setBackgroundColor(R.color.black);
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