Apps development for Android step by step

Lessons related to getColor

Lesson 1.4: How to change a color of text and background in TextView?

From the previous lesson we know how to display a text on Android device’s screens both using XML layout files and Java code. Now it’s time to format that text. We start with font and background colors, but beside a standard text color there are also other options, like links, highlight and hint colors. Moreover we would check current colors.

Read More

Appendix B: Everything about colors in Android

Android uses standard RGB (red, green and blue) color model. Each primary color value is usually represented by hexadecimal number.  At the beginning of such a color definition you have to put a pound character (#).

The simplest is just #RGB format, where #000 is black and #FFF is white. But in this format we have only 16 values per color so it gives 4096 combinations. That’s why #RRGGBB format is mainly used. In this format we have 256 values per primary color, so 16 777 216 colors in total. Black is #000000 and white is #FFFFFF.

Read More