anibyl anibyl - 2 years ago 100
Java Question

How to convert R.color to Color?

Android has 2 types of colors: R.color and color
Layout uses

(I need
holo_blue_light: 17170450 (0x01060012)

but functions (such as setColor()) have the other type of input int (i.e.
CYAN: -16711681 (0xff00ffff)

Negation of
returns incorrect colors. What should I do to convert them?

Answer Source



it returns the int color you are looking for. If the colour comes with Android you can get its id with android.R.color.colourId

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download