我遇到了一个非常烦人的问题。我在我的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
如果我清理项目,问题就会消失,我可以正常构建和运行项目,但现在我正在频繁编辑它,这非常非常令人讨厌。请问有人能帮忙吗?