Android: Circular Google Map fragment

旧时模样 提交于 2019-12-25 13:27:45

问题


I am using Google Map fragment in my Android app. But, I need to be circular in shape like below. How can I implement it?

Map Fragment code snippet is:

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

回答1:


If you don't need the map to be interactive (no swiping, zooming, etc.), then you could use the Google Static Maps API which gives you an image of the requested map: https://developers.google.com/maps/documentation/static-maps/

Then you could put that image inside and ImageView, and apply a circular mask on it (you can find lot's of examples for that on StackOverflow)



来源:https://stackoverflow.com/questions/33385970/android-circular-google-map-fragment

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