In XML, we can set a text color by the textColor attribute, like android:textColor=\"#FF0000\". But how do I change it by coding?
textColor
android:textColor=\"#FF0000\"
I tried s
text.setTextColor(getResource().getColor(R.color.black)) you have create black color in color.xml.
text.setTextColor(getResource().getColor(R.color.black))
OR
text.setTextColor(Color.parseColor("#000000")) here type desired hexcode
text.setTextColor(Color.parseColor("#000000"))
text.setTextColor(Color.BLACK) you can use static color fields
text.setTextColor(Color.BLACK)