How to convert Android.Resource.Color to Android.Graphics.Color
Resources.GetColor
has been deprecated. Make sure you use ContextCompat.GetColor
instead.
So
Resources.GetColor(Resource.Color.HoloOrangeDark);
Will become
int colorInt = ContextCompat.GetColor(this.Context, Resource.Color.HoloOrangeDark))
ContextCompat returns a int so to get a Color out of it just create a new color and pass in the int.
Color color = new Color(colorInt);
Try this in Xamarin also
int colorIntFG = ContextCompat.GetColor(this, Resource.Color.colorCardDaysFGAlert);
txtView.SetTextColor(new Android.Graphics.Color(colorIntFG));
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);