Eclipse与Android布局的main.xml? [英] Eclipse with Android layout's main.xml?

查看:98
本文介绍了Eclipse与Android布局的main.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

移动和消失代码行;与Eclipse的XML编辑器的麻烦

我注意到这个奇怪的问题,每当我尝试编辑布局。这甚至不是编辑的问题。这是我在main.xml文件中点击的问题,就是对,点击。它会自动复制我的行信息,将其推下到下一行,并将整个文件拧紧。 Eclipse在Android中的所有其他文件(如string.xml和java文件)都可以正常工作。有人可以帮助我吗?

I noticed this weird problem with Eclipse whenever i try to edit the layout. It's not even the problem with editing. It's the problem when i click in the main.xml file, thats right, CLICKING. It automatically duplicate my line information, push it down to the next line and screws the whole file up. Eclipse works fine with all my other files like string.xml and java files in Android. Can someone help me out here?

推荐答案

经过一些测试,我发现选项自动格式化由视觉布局编辑器(在首选项| Android |编辑器)可能是这里的祸根。

After some tests, I have found that the option "Automatically format the XML edited by the visual layout editor" (in Preferences | Android | Editors) might be the culprit here.

通过我的测试,我发现更改属性(如layout_gravity ),而在图形布局设计模式中,当我选择此选项为ON时,当我回到XML(文本)模式时,总是拧紧文件的可视化显示,但关闭时我没有问题。

With my tests, I've found that changing a property (such as the layout_gravity) while in Graphical Layout design mode always screw up the visual display of the file when I go back to the XML (text) mode when this option is ON but that I have no problem when it's off.

如果要从图形布局设计模式返回时格式化XML,只需使用快捷键Ctrl-Shift-F。此外,我没有看到使用选项保存格式的任何问题;即使我在图形布局模式下使用它;所以您可以使用Ctrl-S,而您仍然在图形布局模式下保存和格式化XML。

If you want to format the XML upon your return from the Graphical Layout design mode, simply use the shortcut Ctrl-Shift-F. Also, I didn't see any problem with using the option "Format on Save"; even when I use it in the Graphical Layout mode; so you can use Ctrl-S instead while you're still in the Graphical Layout mode to both save and format your XML.

我尝试过其他编辑器选项,如显示范围指示符或使用字符显示垂直标尺的变化,但是通过激活或取消激活这些选项,我没有看到任何行为差异。

I've tried other editors options like "Show range indicator" or "Use characters to show changes in vertical ruler" but I didn't see any difference in behavior with activating or de-activating these options.

最后,以纠正文件在损坏时的视觉显示;我发现使用快捷键:Ctrl-A,Ctrl-C,Ctrl-V比关闭/重新打开文件要容易一些。这相当于选择全部,复制,粘贴;有效地复制整个XML文件。

Finally, to correct the visual display of the file when it's corrupt; I found that using the shortcut: Ctrl-A, Ctrl-C, Ctrl-V is a little easier than closing/reopening the file. This is equivalent to making a Select All, Copy, Paste; effectively copying the whole XML file over itself.

这篇关于Eclipse与Android布局的main.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆