小编Ale*_*lex的帖子

xml中的Android Google Maps片段.我得到"意外的命名空间前缀"

我正在尝试学习android,并按照如何使用Google Maps API V.2的说明进行操作.但是,有关如何配置地图初始状态的说明(在developers.google.com中找到)建议在xml文件中定义名称空间,在本例中为"map".

下面的xml代码给出了错误"Unexpected namespace prefix"map" ".尝试定义片段标记内的xmlns:map会产生相同的错误,但使用"xmlns".

我显然在这里缺少一些基本的xml知识,有人可以帮助我吗?

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"        
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:map="http://schemas.android.com/apk/res-auto"      <!-- Definition -->
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <fragment 
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment"
        map:cameraBearing="112.5"/>                            <!-- PROBLEM -->

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

xml android xml-parsing android-layout google-maps-android-api-2

34
推荐指数
4
解决办法
3万
查看次数