问题
While developing for Android, I am unable to open more than one main.xml file in an Eclipse editor at a time. Each time I open one, it simply replaces the editor (tab) of the first main.xml with the new one, instead of opening a new tab - even if the contents of the existing tab were unsaved!
Even stranger, I can open multiple main.xml files from different projects with no problems. This only happens when they're within the same project.
Any idea how to fix or work around this? It's a real time-waster.
(Running Eclipse Classic 3.5.2 64bit w/ADT 0.9.7 on Win7 Home Premium x64)
Edit for clarity:
It's not the same file opened twice. In one project, there is a file called "main.xml" in a directory called "Layout". There is another file also called "main.xml" in a directory called "Layout-Land". These two files cannot be opened at the same time. I'm not sure if this is a problem with Eclipse or with ADT.
More info:
For kicks I created two new files in those same directories (both called "item.txt") and they both opened properly (each in their own tab). I renamed them both to "item.xml" and tried opening them again, and sure enough they fought for the same tab. This leads me to believe ADT is at fault since xml files in these layout directories are opened with ADT's layout tool. I could be wrong though.
回答1:
Right click on main.mxl and choose 'new editor'- this will create another main.xml which you can replace with the landscape version via a double click.
However, eclipse does this for a reason- so you don't get confused and bork your files up.
I would think you also could edit these files in a text editor to the side with little loss of efficiency.
回答2:
This is because the two different files represent the same layout just in different configurations. If you want to edit the landscape layout you have to click on the 'Layout' tab at the bottom of the editor and select the 'Config' that you want to edit. Depending on the configuration you select you'll have the layout xml editor fill with the correct contents from each file.
来源:https://stackoverflow.com/questions/3485454/unable-to-open-both-main-xml-files-from-layout-layout-land-at-the-same-time