Draw circle of certain radius on map view in Android

后端 未结 6 802
一向
一向 2020-12-08 11:55

I want to draw a circle on map view. I want the user to input the radius and for that radius I have to show circle on map. After that I have to display markers on some locat

6条回答
  •  星月不相逢
    2020-12-08 12:21

    For Kotlin, to draw a circle in the center of the map, you can use

    mMap.setOnCameraIdleListener {
            val midLatLng: LatLng = mMap.cameraPosition.target
    
            mMap.addCircle(CircleOptions()
                    .center(midLatLng)
                    .radius(radiusInMeters)
                    .strokeWidth(1f)
                    .fillColor(0x880000FF))
    }
    

    mMap is GoogleMap

提交回复
热议问题