Mo Prog Mo Prog - 2 months ago 22
Android Question

How to convert Android.Resource.Color to Android.Graphics.Color

I have a value of

Android.Resource.Color
like
Android.Resource.Color.HoloOrangeDark
.

I want to covert it to a
Android.Graphics.Color
.

How can I do that?

Answer

You can try this:

Resources.GetColor(Resource.Color.HoloOrangeDark);

UPDATE:
Resources.GetColor has been deprecated. You can use from ContextCompat like below:

ContextCompat.GetColor(mContext, Resource.Color.HoloOrangeDark);
Comments