我正在尝试向我的清单添加一些属性来初始化我的谷歌地图但我收到此错误:
属性缺少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"/>
答案 0 :(得分:0)
只需在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"/>