2013-03-10 77 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"