Issue
I've created an android application that uses google maps v2. I'm trying to use GroundOverlay in order to position an image over my map but for some reason it's just not working.
From the research I've done and other examples that I've seen on the internet, I've written it into my app in the correct way, so why am I getting no overlay?
Overlay options are within a OnMapLongClick() method in order to place overlay when the user holds their finger on the map. I also call a toastLong() method in order to show a toast to check that the OnMapLongClick method is working as it should be which it is.
The image for the overlay is also definitely there and accessible.
Code below:
//-----map long click
@Override
public void onMapLongClick(LatLng point) {
toastMsg = "on map long click";
toastLong();
//add overlay
BitmapDescriptor image = BitmapDescriptorFactory.fromResource(R.drawable.lower_ui);
GroundOverlayOptions groundOverlay = new GroundOverlayOptions()
.image(image)
.position(point, 500f, 500f)
.transparency(1.0f);
mapView.addGroundOverlay(groundOverlay);
}
Solution
Just a small error: If you look at transparency documentation here https://developers.google.com/android/reference/com/google/android/gms/maps/model/GroundOverlayOptions.html#transparency(float)
you see:
transparency a float in the range [0..1] where 0 means that the ground overlay is opaque and 1 means that the ground overlay is transparent
remove your transparency(1.0f) call or reduce that value and you will see the overlay!
Answered By - N Dorigatti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.