Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse, two different files with the same name in different directories

this is driving me a bit crazy, but the way android lays things out, is you have different directories with the same xml name.

so, for example, you might have:

res/layout/main.xml, and
res/layout-land/main.xml

When you're in landscape mode, it will know to use the one in the layout-land directory.

The really irritating thing is that when I'm in Eclipse, and I have res/layout/main.xml file open, and if in the project explorer I click to open the one in layout-land/main.xml, it just leaves the one you already have open (res/layout/main.xml) open. This is super annoying. You can get around it by simply closing the one that's open, and then when you click to open the one in layout-land it will open the proper one, but not as long as you already have a file with that name (not same directory) open.

Is there any way to fix this other than using a different editor or 'living with it'?

like image 550
user645402 Avatar asked Mar 04 '11 20:03

user645402


1 Answers

When I do as you describe, Eclipse opens the new layout and automatically closes the other one. It appears as if the same file stayed open; however, the contents change, and if you hover over the editor tab, you can see which folder the file comes from. The result is that you can only have one version at a time of a particular layout open in the Android Layout Editor. This is probably a necessary restriction due to the internals of the Android Layout Editor.

If you want to edit both files concurrently, you can open one or both with the XML editor (right-click > Open With > XML Editor).

like image 71
Ted Hopp Avatar answered Sep 27 '22 22:09

Ted Hopp