values 中的颜色“color_name”在基本 values
文件夹中没有声明;当在与此限定符不匹配的配置中查询资源时,这可能会导致崩溃
最佳答案
您应该遵循此添加colors.xml 文件。
app>res>values>colors.xml add color using this tag
<color name="green">#2eaf4d</color>
如果您没有使用此方法创建颜色文件
app>res>values>Right click>New>Value resources file>enter name colors then add this color on that colors.xml file
<color name="green">#2eaf4d</color>
如果您已经尝试过这两种方法,那么您只需要尝试 Android Studio 的通用规则
Invalidate cache & Restart
Rebuild Project
关于java - 我无法向 android studio 中的 color.xml 文件添加颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75845493/