Android Google Maps API V2.0 - Including MapView in XML

浪子不回头ぞ 提交于 2019-12-13 02:24:52

问题


I am trying to insert a MapView into a Fragment however I can't find the correct class to cast the MapView object to.

I am inserting the MapView into my fragment like so.

<com.google.android.gms.MapView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/map_view_track"/>

However, I inevitably get a ClassCastException.

Is it possible to insert a MapView this way? I'm pretty sure it is.


回答1:


com.google.android.gms.Maps does not exist as a class, AFAIK. Try com.google.android.gms.maps.MapView.



来源:https://stackoverflow.com/questions/13803385/android-google-maps-api-v2-0-including-mapview-in-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!