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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 11:58:46  来源:igfitidea点击:

values-21, values-22 or values-xx folder is gone after Android Studio 1.0

javaandroidandroid-studioandroid-styles

提问by DMT82

When I create a new project with API14 as minimum, then there is no values-21or values-22folder in my project. I don't see any styles.XML anywhere, so how should I put in XML code for just Lollipop?

当我创建一个至少使用 API14 的新项目时,我的项目中没有values-21orvalues-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 22has been released. API 23is the same idea.

更新:自API 22发布以来。API 23是一样的想法。

Right click the RESfolder

右键单击RES文件夹

enter image description here

在此处输入图片说明

Then type values-v22as the directory name and choose xml as the resource type.

然后键入values-v22目录名称并选择 xml 作为资源类型。

enter image description here

在此处输入图片说明

If you do NOT see the values-v22show up, clickthe Project pulldown at the top of the screen like so. e.g. Change from Android to Project

如果您没有看到values-v22显示,click屏幕顶部的项目下拉菜单如下所示。例如从 Android 更改为 Project

enter image description here

在此处输入图片说明

Now right click styles.xmlin the values folderand choose copy

现在右键单击styles.xmlvalues folder选择复制

enter image description here

在此处输入图片说明

Now right click the values-v22folder and click paste.

现在右键单击该values-v22文件夹并单击粘贴。

enter image description here

在此处输入图片说明

You should see this popup

你应该看到这个弹出窗口

enter image description here

在此处输入图片说明

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:

这只是一个错误!无论如何,我找到了一种方法来取回它:

  1. Write anything in styles.xmlthat is related to new material theme example: <item name="android:colorPrimary">@color/colorPrimary</item>

  2. It will show you an error hover over it and press Alt+Enter.

  3. choose the first choice Override Resource in values-v21.

  1. styles.xml中写下与新材质主题示例相关的任何内容:<item name="android:colorPrimary">@color/colorPrimary</item>

  2. 它将显示一个错误悬停在它上面并按Alt+ Enter

  3. 在 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.

我知道这不是最好的方法,但它会一直有效,直到有人能找到更好的方法。

回答by zizutg

Try to switch from Androidto [![Project][1]][1]as shown below

尝试从 切换Android[![Project][1]][1]如下图

enter image description here

在此处输入图片说明