I try to draw circles on the Google Maps API, which are transparent.
CircleOptions circleOptions = new CircleOptions()
.center(new LatLng(lat, lon))
.radius(50.0)
.strokeColor(Color.TRANSPARENT)
.strokeWidth(1)
.fillColor(Color.CYAN); //
But I like to draw them transparently, so that I can see the map behind? How could I do that?
For mGoogleMap as GoogleMap
object, with latitude longitude given as
LatLng currentLatLon = new LatLng(lat double value, lng double value);
This is the way to draw circle in google maps
mGoogleMap.addCircle(new CircleOptions()
.center(currentLatLon)
.radius(150)
.strokeColor(Color.RED)
.fillColor(0x220000FF)
.strokeWidth(5)
);
This will add the transparent circle around the marker
Circle mCircle = mMap.addCircle(new CircleOptions()
.center(new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude()))
.radius(500)
.strokeWidth(0)
.strokeColor(Color.parseColor("#2271cce7"))
.fillColor(Color.parseColor("#2271cce7")));
For the Transparent Color you can set it to any Color using i.e #2271cce7
In the above the actual color code is #71cce7 and the first two digits of 22 indicate the transparency which can be set to any value to either increase or decrease transparency.
View Sample
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With