2

I would like to set a red colour text in my app, but I don't know how.

Please provide references. Thanks.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
tiranodev
  • 943
  • 2
  • 8
  • 15

5 Answers5

8

If you want it to set in XML layout then use:

<TextView 
 ...
 ...
 android:textColor="#FF0000" >
 </TextView>

If you want to set programmatically then use:

textview.setTextColor(Color.RED);
//textview must be defined in your class 
Vivek Kalkur
  • 2,200
  • 2
  • 21
  • 40
3

Read the docs for TextView, specifically for textColor.

kabuko
  • 36,028
  • 10
  • 80
  • 93
2

Use the following in your xml where you want to change the color to red and by using the other hexacode of color you can change to any other color. This is an example to set the color to red:

android:textColor="#FF0000" 
PeeHaa
  • 71,436
  • 58
  • 190
  • 262
ravi
  • 177
  • 2
  • 2
  • 11
1

Use this in your layout:

<TextView>
  ....
  textColor="red"
  ....
</TextView>
Kurtis Nusbaum
  • 30,445
  • 13
  • 78
  • 102
1

Create a custom style resource which uses an Android Theme as a parent then override the text colors as defined in the Android theme.xml. Reference this new style in your AndroidManifest.xml's application tag.

Dan S
  • 9,139
  • 3
  • 37
  • 48