问题
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