2013-03-10 103 views
0

我试图在Android中获取我的Google地图来向我展示我的内容。 Java没有显示任何错误。XML错误/ Android SDK

<?xml version="1.0" encoding="utf-8"?> 
<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" > 

<TextView 
    android:id="@+id/tv_location" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" /> 

<fragment xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/map" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_below="@id/tv_location" 
    class="com.google.android.gms.maps.SupportMapFragment" /> 

</RelativeLayout> 

错误是表示xmlns为片段标签明显无效的。有什么建议么?

回答

1

的的xmlns:Android的属性是一个命名空间声明,只应该在你的XML文件中的根布局。

+1

IOW,从您的''元素中删除'xmlns:android =“http://schemas.android.com/apk/res/android”'。 – CommonsWare 2013-03-10 00:23:18

+0

@CommonsWare这是修复它,没有错误,但应用程序只是崩溃......回到绘图板。 – 2013-03-10 00:24:25

+0

@JordanMoffat:使用LogCat查看与崩溃相关的堆栈跟踪。然后,问一个新的SO问题,如果你仍然无法弄清楚你的困难来源。 – CommonsWare 2013-03-10 00:26:02

0

尝试,包括这在你的片段

xmlns:map="http://schemas.android.com/apk/res-auto"