0

AndroidでGoogleマップを取得して、自分のlcoationを表示しようとしています。Javaはエラーを表示していません。

<?xml version="1.0" encoding="utf-8"?>
<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"
    tools:context=".MainActivity" >

<TextView
    android:id="@+id/tv_location"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

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

</RelativeLayout>

エラーはxmlns、フラグメントタグに対して明らかに無効であることを示しています。助言がありますか?

4

2 に答える 2

1

xmlns:android属性は名前空間宣言であり、XMLファイルのルートレイアウトにのみ存在する必要があります。

于 2013-03-10T00:22:39.747 に答える
0

これをフラグメントに含めてみてください

xmlns:map="http://schemas.android.com/apk/res-auto"
于 2013-03-10T00:22:09.670 に答える