After calling setTextColor, text does not appear in TextView

android

Solution

A color value specifies an RGB value with an alpha channel, which can be used in various places such as specifying a solid color for a Drawable or the color to use for text. It always begins with a # character and then is followed by the alpha-red-green-blue information in one of the following formats: #RGB, #ARGB, #RRGGBB or #AARRGGBB.

So do one thing define your color inside the color.xml file as:

<color name="demo_color">#E01B4C</color>

And then access it as below:

 txtChange.setTextColor(R.color.demo_color);

Or

you can also define in the XML layout file itself:

android:textColor="#E01B4C"

Problem

I have a custom cursor adapter and I am trying to set the color of a text box of one of the row views: ``` txtChange.setTextColor(0xE01B4C); txtChange.setText("Hey I'm some Text!"); ``` If I remove the `setTextColor` call the text appears as expected. What am I missing?

Original source

Related problems