【问题标题】:Google Map: Attribute is missing the Android namespace prefix谷歌地图:属性缺少 Android 命名空间前缀
【发布时间】:2015-07-05 10:23:44
【问题描述】:

我正在尝试向我的清单添加一些属性来初始化我的谷歌地图,但我收到了这个错误:

属性缺少 Android 命名空间前缀

我该如何解决?

代码:

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

    <fragment 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:id="@+id/map"
        tools:context=".MapsActivity"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        map:cameraTargetLat = "63.868913" 
        map:cameraTargetLng= "14.665491"
        map:cameraZoom="15"/>

【问题讨论】:

标签: android google-maps android-fragments


【解决方案1】:

只需在 xml 中添加 xmlns:map="http://schemas.android.com/apk/res-auto" 即可:

<fragment 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"
          xmlns:map="http://schemas.android.com/apk/res-auto"
          android:id="@+id/map"
          tools:context=".MapsActivity"
          android:name="com.google.android.gms.maps.SupportMapFragment"
          map:cameraTargetLat="63.868913"
          map:cameraTargetLng="14.665491"
          map:cameraZoom="15"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-20
    • 1970-01-01
    • 1970-01-01
    • 2013-08-20
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多