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?
Android green is a shade of chartreuse or Caribbean green, defined by Google as the color of the "Android robot" logo for the Android operating system.
red(int) to extract the red component. green(int) to extract the green component. blue(int) to extract the blue component.
Named Color Resources in Android (Note: To add a new resource first select the app in the Project explorer file. Then use the File or context menu, usually right-click, then the New option and select Android resource file. A color resource does not need to be stored in colors. xml, other file names can be used.)
You can try this . File -> Settings -> Colors&Fonts -> Java(XML) -> change foreground you want on the right- top whee I tag. if you want change XML code color , you can find XML to change . You can download jar.
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);
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With