加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 23:11:42 所属栏目:百科 来源:网络整理
导读:我有一个恼人的问题.我在我的 Android项目中使用Fragment,这让我感到无尽的痛苦,因为我每次编辑主xml文件时都必须清理项目.这是它的样子: ?xml version="1.0" encoding="utf-8"?RelativeLayout xmlns:android="http://schemas.android.com/apk/res/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文件将清理目标设置为构建的一部分.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读