开发者

XML Problems with Eclipse / Android SDK

I'm fairly new to eclipse and android development, and I'm having what must be a pretty simple error to fix. I've done some development on my laptop and never encountered these errors. (I currently only have access to public computers, and have eclipse and the SDK installed on a USB drive.)

The first strange thing I noticed when editing the main layout was that there is no properties window to allow easy editing of various layouts and objects. (There was on my old开发者_如何学C computer) I have not been able to figure out how to get this window to appear.

So after adding one textView and modifying its properties by hand, I receive the following two errors when I attempt to run the program. (No code has even been added yet, just one textView)

http://i.stack.imgur.com/9VGT0.png (Link to screenshot of error, only have 6 rep)

All I've done is change the textView to have center gravity, fill_parent layout width, and a textSize of 22sp. I've tried googling the errors to figure out what I'm doing wrong but have been unsuccessful. Anybody encounter this before? Also, if anybody knows how to make the properties window appear it would be a great help.

Thanks in advance


When compiling Android stuff in Eclipse, you have to press the "Run" button with a .java file open, not with .xml file open. No idea why, but the glitch is there and you'll soon remember to avoid it.

To fix the current state, delete the 'main.out.xml' file (it was automatically created on compile). Then in the 'Problems' tab (the one on your screenshot), manually delete each problem it shows you. After that, press Run again with a .java file open and it should solve whatever is there now.


You get the properties window back from the "Show View" dialog, which is accessible from the "Window" -> "Show View" -> "Other ..." menu.

Once the dialog is open, look in the "General" folder for "Properties".


right click the .xml file and go to Open With... there are many ways to open it. I prefer the xml editor but there is also a layout editor available.


Your XML is not well-formed, e.g. mismatched elements, mismatched quotes, etc. Show your XML for more specific assistance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜