Android Google Maps API V2.0 - 在XML中包含MapView

Stu*_*ing 1 android android-maps

我试图将MapView插入到Fragment中但是我找不到将MapView对象强制转换为的正确类.

我MapView像这样插入我的片段.

<com.google.android.gms.MapView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/map_view_track"/>
Run Code Online (Sandbox Code Playgroud)

但是,我不可避免地得到了一个ClassCastException.

是否可以这样插入MapView?我很确定它是.

Com*_*are 6

com.google.android.gms.Maps不存在作为AFAIK类.试试com.google.android.gms.maps.MapView.