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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:44:33  来源:igfitidea点击:

Android-Studio to show XML code instead of design

androidintellij-ideaandroid-studio

提问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?这很烦人,因为我很少使用“设计”选项卡。这是我正在谈论的内容的屏幕截图:

Design & Text Tabs

设计和文本选项卡

Thanks in advance.

提前致谢。

采纳答案by Simas

This has been added in the newest release of Android Studio (0.8.12).

这已添加到最新版本的 Android Studio (0.8.12) 中。

default to xml editor

默认为 xml 编辑器

Other features of the new release can be found here.

可以在此处找到新版本的其他功能。

回答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 | Settingsfor Windows and Linux or IntelliJ IDEA | Preferencesfor OS X
  • Press Ctrl+Shift+A, type settings and press Enter.
  • Ctrl+Alt+S
  • 在主菜单上,选择File | SettingsWindows 和 Linux 或IntelliJ IDEA | PreferencesOS X
  • Ctrl+Shift+A,键入设置并按Enter

Then navigate to the following sub-menu:

然后导航到以下子菜单:

Editor -> Layout Editor -> "Prefer XML editor"

Screenshot of the Preferences

首选项的屏幕截图

回答by Aravind Subramaniam

Here is the screen shot of the latest version

这是最新版本的屏幕截图

Look at the top right corner of the image

看看图片的右上角

回答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 文件。