今天运行程序时,出现了这样的错误Unexpected namespace prefix "xmlns" found for tag LinearLayout。原因是因xmlns:android=http://schemas.android.com/apk/res/android这行重复造成的。一般只需要顶层地Layout需要xmlns:android="http://schemas.android.com/apk/res/android" 属性。
其他的Layout去掉该xmlns属性。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="北京" />
<EditText
android:id="@+id/geocodekey"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="海淀区上地十街10号" />
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button android:id="@+id/geocode"
android:text="CeoCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="ReverseCeoCode"
android:id="@+id/reversegeocode"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<com.baidu.mapapi.MapView android:id="@+id/bmapView"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:clickable="true"
/>
</LinearLayout>