令人费解的Android xmlns错误
我在许多地图示例中都遇到过类似的代码:令人费解的Android xmlns错误,android,Android,我在许多地图示例中都遇到过类似的代码: <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=".
<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" >
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
</RelativeLayout>
然而,对于他们所有人来说,我都会犯错误
说明资源路径位置类型意外的命名空间前缀
找到标记的“xmlns”
片段活动\u msmap.xml/example/res/layout第8行Android Lint
问题
排队
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
在xml布局中不能两次定义命名空间。
只要从片段中删除它,RelativeLayout已经定义了xmlns:android名称空间
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
感谢您的澄清:)