Android-Studio to show XML code instead of design
AndroidIntellij IdeaAndroid StudioAndroid Problem Overview
I'm using IntelliJ Android-Studio 0.8.2 and i'd like to know if it's possible to open the code by default when editing XML files?
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:
Thanks in advance.
Android Solutions
Solution 1 - Android
Newer (I guess 2.x+) versions of Android Studio have this option in the main settings:
Open the settings with 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
.
Then navigate to the following sub-menu:
Editor -> Layout Editor -> "Prefer XML editor"
Solution 2 - Android
This has been added in the newest release of Android Studio (0.8.12).
Other features of the new release can be found here.
Solution 3 - Android
Here is the screen shot of the latest version
Solution 4 - Android
UPDATE 2021
Using Android Studio Artic Fox 2020.3.1 it's Design Tools in Settings Menu (CtrlAltS) instead of Layout Editor:
Solution 5 - Android
Solution 6 - Android
Since in the new update, the feature of viewing the code of XML has changed, there are some series of steps that are needed to be followed.
Step 1: Press Ctrl + Alt + S (Basically opening settings)
Step 2:Click on the layout editor and choose the default Editor mode as you wish. In my case I want it to be in split mode (You will be able to see both code and its output at the same screen or window).
Step 3: Click on Apply and OK.
Step 4: Close all the opened XML or the design files . Now after this step , if you open any other file present at your project, you would be realizing that the mode in which the file is opened is at the mode you chose at the Step 2 .
Solution 7 - Android
Mac
Android Studio > Preferences > Editor > Layout Editor change to the view as per your desire.
Also you can switch between views Using Cmd + Shift + Left/Right Arrow
Solution 8 - Android
In the new Android Studio 4.1 this option is somewhat changed to :
To access this visit Android Studio -> Preference from the menu bar search for design and select layout editor and change the mode to your desired one.
Thanks
Solution 9 - Android
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.