I'm getting errors when I try to create a new xml file in eclipse
I'm trying to create an attrs.xml file under res\values (so I can add AdMob ads). I right click values, select new, other, XML File, next, give it the name attrs.xml and the file is created, but there are 2 red x marks in the margin. If I hold my cursor over the开发者_运维问答 x's, the top one (beside the line ) says Premature end of file, and the x right under that line (which is just a blank line) says errro: Error parsing XML: no element found.
Any idea why this is happening? I have shut down and restarted Eclipse, repeated the process and gotten the same results.
An empty xml file will always give you that error.
You need to fill the xml file with some android UI elements, like so -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</LinearLayout>
Once you fill the xml file, rebuild the project the errors should go away..
精彩评论