0

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>
3
  • remove -> and all text after it Commented Aug 11, 2014 at 12:03
  • well, i have added this line to show you the correct line, but in my project i don't have this sentence. Commented Aug 11, 2014 at 12:04
  • 1
    add xmlns:android="schemas.android.com/apk/res/android" to fragment Commented Aug 11, 2014 at 12:04

1 Answer 1

4

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" />
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.