Carlos Uriel Santiago Carlos Uriel Santiago - 4 months ago 48
Android Question

Background color using rgb on android (XML preferred)?

It's silly, but how to put a background rgb on android?

I'm trying to put a background of RGB color, but I can not find how to do.

android:background= ?
android:orientation="vertical" >

I've done it this way, but does not work



You can set RGB color with hax code in Android, like Hex Code #RRGGBB

Here are some sample colors:

Color   Hex RGB  Decimal Code
White   #FFFFFF (255,255,255)
Red     #FF0000 (255,0,0)
Lime    #00FF00 (0,255,0)
Blue    #0000FF (0,0,255)

For example you want to set color blue in your View background

android:background= "#0000FF"

It is always better to define your color in Color res folder.