简体   繁体   中英

xml issue on android application

i' m new on android and i'm getting this error on my main.xml , can someone tell me how to fix,and how to prevent these errors?

the line <fragment -> Error parsing XML: unbound prefix

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <Button
        android:id="@+id/showBtn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:text="@string/show" />

    <!-- ***error: Error parsing XML: unbound prefix*** -->
    <fragment 
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.MapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/showBtn"
        map:cameraTilt="30"
        map:cameraZoom="5"
        map:uiCompass="false"
        map:uiRotateGestures="true"
        map:uiTiltGestures="true"
        map:uiZoomGestures="true" />

</RelativeLayout>

Make your fragment in xml like so

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:map="http://schemas.android.com/apk/res-auto"
  android:id="@+id/fragmentGoogleMaps"
  android:name="com.google.android.gms.maps.MapFragment"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  map:cameraZoom="17"
  map:uiCompass="false"
  map:uiRotateGestures="true"
  map:uiScrollGestures="true"
  map:uiTiltGestures="false"
  map:uiZoomControls="true"
  map:uiZoomGestures="true" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM