is it possible in eclipse to display both Graphical Layout view next to a Textual XML Editor for the same XML Layout file?
the reason is that i want to see the results in the graphical layout as soon as i save changes to the XML Editor, without the need to change tabs.
You can open any file in Eclipse in multiple editors and display them side-by-side. All editors referencing the same file will share the same editing buffer, so the changes in one should be reflected in the other. Just right click on the file and use the "Open With" menu item to open the editors you need. Then drag the opened editors around your workbench so that they are displayed side-by-side.
Related
I'm new to Android development and for me, a good way to learn how the Graphic layout and xml relate to each other is by trying an xml attribute and see the changes in the Graphic UI. Is there a way to see both side by side in the same time and not have to switch from one to another?
The picture show what I want to achieve.
Here is a better answer.
Open Layout
Windows -> New Editor
Set one window to Graphical, another window to xml
Eclipse IDE - Android Graphical Layout and XML Layout Side by Side
Use IntelliJ Idea. It's an IDE that has this feature.
Edit: I'm not sure I understood your question well, but what I got was that you want to make changes and see them update automatically. This feature IS present in Idea:
In the mean time I've found a different and more elegant way of doing this split (still in Eclipse R 4.4.0 + ADT 23.0.3.1327240):
Open Layout XML file.
Window > Editor > Toggle Split Editor (Vertical)
Select Graphical Layout in the pane to the right.
The clever thing about this approach is that the two split panes are retained within the editor tab.
Currently Both graphical and xml editor in same window is not there in Eclipse.
Update your Android SDK Tools to Revision 21
The update includes new tools and capabilities that can help you work more efficiently as you create applications. Tools such as a new multi-config editor, and new Lint rules will help you..
Ref here:enter link description here
Multi-config editor
A new multi-configuration editor allows you to develop and prototype your UI across various orientations, screen sizes and locales. For example, while editing your layout in portrait mode, you can see if your edits aren't visible in the shorter landscape orientation.
Here's how to do it in Eclipse Luna R 4.4.0 + ADT 23.0.3.1327240:
Open Layout XML file.
Window -> Editor Clone
Drag the new editor tab and place it next to the current editor window.
Set one editor window to Graphical Layout and the other to XML.
I can recommend an Eclipse setup with three windows next to each other:
Package Explorer, usually collapsed) | 2. XML | 3. Graphical with its Outline Structure panel open.
Caveats:
Changes made in XML do not automatically get reflected in the graphical window; you need to perform some action here, a click will suffice.
Selecting a new XML file in the Package Explorer will only open it in one (e.g. the XML) editor window, not both; you will need to select the other (e.g. Graphical) editor window and open the file in here too. Thankfully both windows have tabs of recently opened files, so this isn't that much of a hassle.
The usual Outline Window (Window > Show View > Outline) links with the currently selected editor; if you don't show the same file in both the Graphical and XML editor window, things may get confusing.
Is it possible to have the Android Graphical Layout next to the Android XML layout so I can modify both simultaneously? It would be much better to change the XML and instantly see the effects, as opposed to clicking the tab to change it all the time.
Yes, although I just tried it and it has a bit of lag after you change something in the Graphical Layout editor.
Open your layout file, such as "activity_foo.xml".
Choose the menu item "Window > New Editor". This will give you another editor for the same layout. In this example, you'll see two tabs that both have "activity_foo.xml".
Mouse press on the second tab and then drag it to the right and downwards, until you see the outlines of two rectangles representing editor views side by side, then let go of the mouse button.
You now have the editors side by side. Place one into Graphical Layout mode and the other into XML mode by choosing the respective tabs.
Note that it seems like the Graphical Layout will consistently update the XML. However, changes in the XML don't seem to affect the Graphical Layout until you save and then click in the Graphical Editor again.
I managed to make the code instantly update the graphical layout and to have both of them shown at the same time.
First, I followed the steps given by louielouie on his answer to have both graphical layout and XML code shown at the same time but this wasn't enough.
Then, I clicked on the code of the XML file and after that I clicked on the graphical layout. At this point, I was able to make changes on the XML file and they were instantly shown in the graphical layout.
There is a little bit better possibility to do that then with new editor like louielouie wroted..
1) Open your layout from project explorer and show it in graphical layout.
2) Get project explorer, right click on your layout
3) Select OPEN WITH -> XML EDITOR
4) At bottom you can switch between Source and Design layout.
5) Catch the 'header' and put it on the side of your graphical layout.
In short word just right click your layout -> open with -> xml editor.
I was trying to customize Eclipse for Android development and ran into this "problem".
When you open a XML file with the Common Android XML Editor you get 2 tabs at the bottom, Graphical Layout and the regular text source.
When you open a XML file with the XML Editor you get 2 tabs, Design and Source. Design being the Node view which I find useful sometimes.
Is it possible to somehow get the Design tab in the Common Android XML Editor window?
Even though you can't reuse tabs from one editor in another (at least, not without programming, as Konstantin pointed out), you can open the same file in two different editors at the same time and have them side-by-side. Open the file with the default editor, then right-click on the file, choose Open With, and select the alternate editor. With both editor open, you can drag the tab of one of them and move it so the two are side-by-side.
As a user you cannot take a page from one editor and use it in another. Depending on the implementation details of the editor pages, a plugin developer could create a new editor implementation that re-uses existing pages.
Until today (I have no idea what I did to cause this), if I double-clicked an android XML file, then the correct editor would appear.
For example, double-clicking a layout file would open a Graphical Layout tab and a tab with the XML contents for direct editing (named as the file being edited). Now all I get is a Design and a Source tab!
I am unable to preview the layouts I am editing (this is the same as here: Graphical Layout tab does not appear for some layout files into Eclipse)
That link also gives a 'workaround' in that I can right-click the file and open with the right editor, but this isn't a solution!
How can I sort this permenantly? I have re-installed fresh Eclipse, ADT to no avail (haven't used fresh SDK... will that matter??).
** Note this happens to all Android XML files, not just layout ones I mentioned above! **
Yes this may be a permanent solution:
Select any XML layout file
click on Window->Preferences menu.
Follow steps as mentioned in attached image.
What I had to end up doing was selecting the Legacy Android Xml Resources Editor from the same list that Paresh is showing and setting it as the default. I had to choose it from the list that appears when you click the add button. After that I restarted eclipse and everything was fine.
when i open xml file i cant see drag and drop tool for editing,instead i see the tool as a table containing Node and Content columns,how can i change that into normal drag and drop tool
With the XML layout file opened, at the bottom there should appear 2 tabs: Graphical Layout and .xml. Click on Graphical Layout.
If you don't have these tabs available then try right clicking on the XML file, select "Open with" and finally select "Android Layout Editor". Next you should be able to see the 2 tabs and the bottom.
You might want to update (if you have not yet) to the latest ADT tools as the Drag and drop tool has greatly improved.