每次编辑XML文件时都必须清理Eclipse中的整个Android项目

我有一个恼人的问题.我在我的 Android项目中使用Fragment,这让我感到无尽的痛苦,因为我每次编辑主xml文件时都必须清理项目.这是它的样子:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <fragment xmlns:map="http://schemas.android.com/apk/res-auto"
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        class="com.google.android.gms.maps.MapFragment"
        map:uiRotateGestures="false"
        map:uiScrollGestures="false"
        map:uiZoomControls="false"
        map:uiZoomGestures="false" 
        map:cameraZoom="18"
        />
    <ScrollView 
        android:id="@+id/scroller"
        android:layout_width="250dp"
        android:layout_height="100dp"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:background="@android:color/white">
    <TextView
        android:id="@+id/debug_text"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:textSize="10sp"

       />
    </ScrollView>
</RelativeLayout>

如果我甚至编辑该文件一个字符,则以“map”开头的所有行都会以红色突出显示,并且片段开始标记也会突出显示.我得到的错误是:

Unexpected namespace prefix "xmlns" found for tag fragment

对于以“map”开头的行,错误是:

Unexpected namespace prefix "map" found for tag fragment

如果我清理项目问题就会消失,我可以很好地构建和运行项目,但是由于我现在正在编辑它很多,所以它非常烦人.有人可以帮忙吗?

解决方法

在Eclipse中,您可以转到Project – >自动构建,应该包括一个干净的过程.您还可以使用adb构建ANT脚本,并使用build.xml文件将清理目标设置为构建的一部分.

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念