Today, when making a program, I think the background color of the TextView is not good, and I want to change the TextView color in the XML file. Because I have a colors.xml file in/res/values, use android:background= "@colors/lightyellow" in the XML file to set the background color of the TextView control to bright yellow. Result error: No resource found that matches the given name (at ' Background ' with value
' @colors/lightyellow '). Later on the online search solutions, saw an expert published the following ideas: You should always reference @color. If you reference @colors, then that ' d is good. Basically, when you type @color, it goes to/res/values and looks through the XML files there for a color value. Thus, the name of the XML file is actually arbitrary, as long as you have it in/res/values.
Consciousness is as long as your color file in the/res/values directory, regardless of the file name of your files, you have to use the @color method reference, probably because it only look at the XML file there is no <color></color> tag, do not look at the file name. By expert guidance, changed to android:background= "@color/lightyellow" the consequences of really no error, and successfully changed the background color of the TextView control.
Android common error No resource found that matches the given name