java values-21、values-22 或 values-xx 文件夹在 Android Studio 1.0 之后消失了
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27553431/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
values-21, values-22 or values-xx folder is gone after Android Studio 1.0
提问by DMT82
When I create a new project with API14 as minimum, then there is no values-21
or values-22
folder in my project. I don't see any styles.XML anywhere, so how should I put in XML code for just Lollipop?
当我创建一个至少使用 API14 的新项目时,我的项目中没有values-21
orvalues-22
文件夹。我在任何地方都没有看到任何 style.XML,那么我应该如何为 Lollipop 输入 XML 代码?
I use Android Studio 1.0.1, and I have SDK 21, 21.1.1, 24.0.2 installed.
我使用 Android Studio 1.0.1,并且安装了 SDK 21、21.1.1、24.0.2。
回答by bjiang
Updated: Since API 22
has been released. API 23
is the same idea.
更新:自API 22
发布以来。API 23
是一样的想法。
Right click the RES
folder
右键单击RES
文件夹
Then type values-v22
as the directory name and choose xml as the resource type.
然后键入values-v22
目录名称并选择 xml 作为资源类型。
If you do NOT see the values-v22
show up, click
the Project pulldown at the top of the screen like so. e.g. Change from Android to Project
如果您没有看到values-v22
显示,click
屏幕顶部的项目下拉菜单如下所示。例如从 Android 更改为 Project
Now right click styles.xml
in the values folder
and choose copy
现在右键单击styles.xml
在values folder
选择复制
Now right click the values-v22
folder and click paste.
现在右键单击该values-v22
文件夹并单击粘贴。
You should see this popup
你应该看到这个弹出窗口
Click ok
点击 ok
At this point you should be good to go.
此时,您应该可以开始了。
回答by humazed
It is just a bug! Anyway I find a way to get it back:
这只是一个错误!无论如何,我找到了一种方法来取回它:
Write anything in styles.xmlthat is related to new material theme example:
<item name="android:colorPrimary">@color/colorPrimary</item>
It will show you an error hover over it and press Alt+Enter.
choose the first choice Override Resource in values-v21.
在styles.xml中写下与新材质主题示例相关的任何内容:
<item name="android:colorPrimary">@color/colorPrimary</item>
它将显示一个错误悬停在它上面并按Alt+ Enter。
在 values-v21 中选择第一个选项 Override Resource。
I know it isn't the best way to do that, but it works until anyone can find a better way.
我知道这不是最好的方法,但它会一直有效,直到有人能找到更好的方法。