0

I'm trying to work with google maps for android v2. I followed the instructions from:

https://developers.google.com/maps/documentation/android/start

I'm at the bottom (of the above webpage) where it says "Add a Map". When I copy and paste the following code into my main.xml:

    <fragment xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/map"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   class="com.google.android.gms.maps.MapFragment"/>

I am greeted by an error on the Linearlayout tag that says: "The markup in the document following the root element must be well-formed."

Here is main.xml in its entirety:

 <?xml version="1.0" encoding="utf-8"?>

 <fragment xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/map"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   class="com.google.android.gms.maps.MapFragment"/>


 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="horizontal"
     android:padding="30dip">



    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginBottom="25dip"
        android:text="@string/welcome"
        android:textSize="24sp"/>

    <EditText
        android:id="@+id/editText1"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" 
        android:hint="@string/edit_location"/>

    <Button
        android:id="@+id/find_me_button"
        android:layout_weight="0"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/button_find_me"/>

    </LinearLayout>

WHY is this not well-formed?

edit: I've tried deleting "xmlns:android="http://schemas.android.com/apk/res/android" from LinearLayout but it doesn't make a difference.

1
  • You fix this problem ? Commented Feb 19, 2013 at 7:05

1 Answer 1

3

Please try this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="horizontal"
 android:padding="30dip">

 <fragment
  android:id="@+id/map"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  class="com.google.android.gms.maps.MapFragment"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:layout_marginBottom="25dip"
    android:text="@string/welcome"
    android:textSize="24sp"/>

<EditText
    android:id="@+id/editText1"
    android:layout_weight="1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ems="10" 
    android:hint="@string/edit_location"/>

<Button
    android:id="@+id/find_me_button"
    android:layout_weight="0"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="@string/button_find_me"/>

</LinearLayout>

It may help you.

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.