<menu xmlns:android =“http://schemas.android.com/apk/res/android”> </menu>出现在main.xml中

时间:2013-11-22 13:20:42

标签: android xml namespaces

我正在尝试在Eclipse中创建一个Android项目。在菜单目录中,我试图替换现有main.xml的内容。但是

 <menu xmlns:android="http://schemas.android.com/apk/res/android"></menu> 
无论我删除它多少次,

一直显示为main.xml的最底线。到底是怎么回事?我需要关闭Eclipse中是否存在某种类型的设置。

Eclipse旁边的行显示错误消息:

“根元素后面的文档中的标记必须格式正确。”

我想用以下内容替换main.xml:

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent" >
 <TextView
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:text="@string/hello" />
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/txtSpace" />
 <TextView 
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/txtFirstNumber" />
 <EditText
 android:inputType="numberDecimal"
 android:id="@+id/EditText01"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content" > </EditText>
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/txtSpace" />
 <TextView
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="@string/txtSecondNumber" />
 <Button 
 android:text="Multiply"
 android:id="@+id/Button01"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"> </Button>
 </LinearLayout>

1 个答案:

答案 0 :(得分:1)

我也有这个问题。

在以下位置检查您的Eclipse设置:

窗口 - &gt;偏好 - &gt; Java - &gt;编辑 - &gt;保存操作|在保存

上执行选定的操作