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.xmlWhen 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'?
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).
This is fixed in the latest Indigo release of Eclipse (Service Release 1), however it doesn't always open the files in the layout-land folder with the Android Layout editor. To force this you can right-click on the file and select Open With... > Android Layout Editor.
精彩评论