2017-07-18 56 views
0

我試圖建立與下面的XML映射活動:地圖片段渲染錯誤

<com.google.android.gms.maps.MapView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:map="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/mapView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

<fragment 
    android:id="@+id/map" 
    android:name="com.google.android.gms.maps.SupportMapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.getfamiliarwiththemap.MapsActivity" > 



    <LinearLayout 
     android:id="@+id/mLlayoutBottomButtons" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_alignParentBottom="true" 
     android:orientation="vertical" > 

    <Button 

    android:id="@+id/ok" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Select" 
    android:textColor="#ffec00" 
    android:background="#b600ff" 
     android:layout_marginBottom="5dp" 
     android:layout_marginTop="500dp" 
     android:layout_marginLeft="150dp" 
     android:layout_marginRight="150dp" 

    /> 

    </LinearLayout> 

</fragment> 

    </com.google.android.gms.maps.MapView> 

,我不斷得到渲染錯誤:未知片段 有人能教我安裝此谷歌的正確方法手動播放服務SDK?我有一個名爲google_play_services的文件夾,這就是我想要使用的。

+0

[Android Studio中谷歌地圖V2片段渲染(可能的重複https://stackoverflow.com/questions/23898992/android-studio-google-map- v2-fragment-rendering) –

+0

你能告訴我應該考慮哪個答案嗎? :| @ Jace J McPherson所有你們知道的是如何胸圍重複... –

+0

看起來你應該能夠閱讀那篇文章的答案,並找出你想要做什麼。如果不創建自己的自定義佈局,則無法渲染此片段。我不會在其他地方已經回答的問題上留下回答。提供鏈接是我能做的最有幫助的事情。 –

回答

-1

嘗試使用的class代替android:name

<fragment 
    android:id="@+id/map" 
    class="com.google.android.gms.maps.SupportMapFragment" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.example.getfamiliarwiththemap.MapsActivity" > 
+0

我試過了,我得到了:在包'android'中找不到屬性'class'的資源標識符 –