Is there a way to call colors from colors.xml in java? I created an editor and I want to use the colors that I already defined in colors.xml from java how can I do this?
To get the color as an int, use the following:
int myColor = getResources().getColor(R.color.myColor);
Then, to use this color in a TextView, use the following:
myTextView.setTextColor(myColor);
Use this:
getResources().getColor(R.color.your_color);
You can directly set the text in the text box:
myTextView.setTextColor (GetResources () GetColor (R.color.your_color).);
Source: https://habr.com/ru/post/986723/More articles:Laravel - dynamically create tables (no migration) - phpHow to use code from one class to another? (Java) - javaAre syntax sugar enumerations for `list (generator expression)` in Python 3? - pythonGuava: MemoizingSupplier thread safety - javaHow can I check in C # if a class property is used in a Visual Studio solution? - reflectionDependency injection inside the FilterAttribute attribute in ASP.NET MVC 6 - filterSampling by coefficient in R - rCan expression be used in switch statement? - c #Codemirror autoresists to a given number of lines - javascriptJavaFX CSS button with image - how to determine image size? - cssAll Articles