Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android-Studio to show XML code instead of design

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:

Design & Text Tabs

Thanks in advance.

like image 838
Simas Avatar asked Jul 16 '14 09:07

Simas


People also ask

How can I see the XML code?

View an XML file in a browserIn Chrome, just open a new tab and drag the XML file over. Alternatively, right click on the XML file and hover over "Open with" then click "Chrome".

Why XML is used in Android instead of html?

I think the xml is chosen because the xml tags are defined in android according to the UI framework classes and the attributes are defined corresponding to the member variables of the class in the UI framework. This mapping was not possible for the html.

Can we use html instead of XML in Android Studio?

yes it is possible you can design whole page in html and stored in Asset folder with image used,css,script folder,and in android activity you just open it in webView .


2 Answers

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 or IntelliJ IDEA | Preferences for OS X
  • Press Ctrl+Shift+A, type settings and press Enter.

Then navigate to the following sub-menu:

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

Screenshot of the Preferences

like image 123
Patrick Favre Avatar answered Oct 06 '22 00:10

Patrick Favre


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

default to xml editor

Other features of the new release can be found here.

like image 22
Simas Avatar answered Oct 06 '22 00:10

Simas