Android的谷歌地图片段中的XML。我得到"意外的命名空间preFIX" [英] Android Google Maps fragment in the xml. I get "Unexpected namespace prefix"

查看:131
本文介绍了Android的谷歌地图片段中的XML。我得到"意外的命名空间preFIX"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习Android和已经跟随了如何使用谷歌地图API V.2现在我懂了工作的指示。 然而,关于如何配置的地图的初始状态的指示,发现了在<一href="https://developers.google.com/maps/documentation/android/map#using_xml_attributes">developers.google.com,建议在XML文件中定义的命名空间,在这种情况下,地图。

该XML的$ C $低于C给出配有错误的意外的命名空间preFIX地图。试图定义的的xmlns:地图片段标记中作出了同样的错误,但用的xmlns。

我明明在这里缺少一些基本的XML知识,有人可以帮我吗?

 &LT; RelativeLayout的
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    的xmlns:工具=htt​​p://schemas.android.com/tool​​s
    的xmlns:地图=htt​​p://schemas.android.com/apk/res-auto&LT;  - 定义 - &GT;
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent&GT;

    &LT;片段
        机器人:ID =@ + ID /图
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        类=com.google.android.gms.maps.SupportMapFragment
        图:cameraBearing =112.5/&GT; &LT;! - 问题 - &GT;

&LT; / RelativeLayout的&GT;
 

解决方案

您需要做两件事情:

第一: <一href="https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw">https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw

添加到依赖谷歌播放服务到您的项目

 项目 - &GT;属性 - &GT; Android的 - &GT;图书馆,添加 - &GT;谷歌播放的,services_lib
 

第二个: <一href="https://developers.google.com/maps/documentation/android/intro">https://developers.google.com/maps/documentation/android/intro

选择项目>属性,选择Java Build Path,并导航到库。 选择添加外部JAR,包括以下jar文件,然后单击确定:

 &LT; Android的SDK文件夹&GT; /extras/android/compatibility/v4/android-support-v4.jar
 

现在我的项目显示了没有错误:) 问候,烫发

I'm trying to learn android, and having followed the instructions on how to use the Google Maps API V.2 I now got it working. However, the instructions on how to configure the initial state of the maps, found at developers.google.com, suggests a namespace defined in the xml-file, in this case "map".

The xml-code below gives med the error "Unexpected namespace prefix "map"". Trying to define the xmlns:map inside the fragment tag gave the same error but with "xmlns".

I'm obviously missing some fundamental xml-knowledge here, can someone help me out?

<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>

解决方案

you have to do two things:

first: https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw

Add the dependency to Google Play Services into your project

Project -> Properties -> Android -> Library, Add -> google-play-services_lib

second: https://developers.google.com/maps/documentation/android/intro

Select Project > Properties, select Java Build Path, and navigate to Libraries. Select Add External Jars, include the following jar files, and click OK:

<android-sdk-folder>/extras/android/compatibility/v4/android-support-v4.jar

now my project shows no errors anymore :) regards, marcel

这篇关于Android的谷歌地图片段中的XML。我得到&QUOT;意外的命名空间preFIX&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆