Android-Studio 显示 XML 代码而不是设计
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24777497/
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
Android-Studio to show XML code instead of design
提问by Simas
I'm using IntelliJ Android-Studio 0.8.2and i'd like to know if it's possible to open the code by default when editing XML files?
我正在使用IntelliJ Android-Studio 0.8.2,我想知道在编辑 XML 文件时是否可以默认打开代码?
Opening multiple files always shows Design tab, while opening single files, though, it sometimes opens them in Text tab but sometimes not.
打开多个文件总是显示“设计”选项卡,而打开单个文件时,它有时会在“文本”选项卡中打开它们,但有时不会。
Is there any way to set the default tab to Text? It's pretty annoying as I rarely use the Design tab. Here's a screenshot of what I'm talking about:
有没有办法将默认选项卡设置为Text?这很烦人,因为我很少使用“设计”选项卡。这是我正在谈论的内容的屏幕截图:
Thanks in advance.
提前致谢。
采纳答案by Simas
回答by Patrick Favre
Newer (I guess 2.x+) versions of Android Studio have this option in the main settings:
较新(我猜是 2.x+)版本的 Android Studio 在主要设置中有这个选项:
Open the settingswith one of the following actions:
使用以下操作之一打开设置:
- Press
Ctrl+Alt+S
. - On the main menu, choose
File | Settings
for Windows and Linux orIntelliJ IDEA | Preferences
for OS X - Press
Ctrl+Shift+A
, type settings and pressEnter
.
- 按
Ctrl+Alt+S
。 - 在主菜单上,选择
File | Settings
Windows 和 Linux 或IntelliJ IDEA | Preferences
OS X - 按
Ctrl+Shift+A
,键入设置并按Enter
。
Then navigate to the following sub-menu:
然后导航到以下子菜单:
Editor -> Layout Editor -> "Prefer XML editor"
回答by Aravind Subramaniam
回答by Larry Schiefer
The Android Designer editor always opens files in the "Design" mode by default. Once you have it open you can switch to "Text" mode and it will retain that setting for that file. However, there's no option to have it default to opening XML files in "Text" mode.
默认情况下,Android Designer 编辑器始终以“设计”模式打开文件。打开它后,您可以切换到“文本”模式,它将保留该文件的设置。但是,没有选择让它默认以“文本”模式打开 XML 文件。