Setting opacity/alpha with shapes/tiles in Google Android v2 - android

I'm working on an app based on Google Maps Android v2. Simply put I want to render some shapes or animations on the map.
Looking over the Android developer spec at https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/package-summary
I see you can add Shapes, Polylines, and tiles. None of them seem to have an opacity or alpha property I can set.
Ideally, I just want to set a circle on a marker (either by using the same LatLng) or as a property of the marker itself (overload Marker?) and have this circle be animated and partially transparent.
Ultimately I'm going to want some control over these objects and how they render. Are tiles more appropriate?

All shapes (Polylines, Polygons and Circles) accept ARGB as their fill and stroke colors. Just use translucent color like 0xAA00FFFF.

Related

Google Maps Android api circle bound

I got a question in my mind about how can I bound 2(or more) circle via android api.
The right side of the image is what I exactly want.
this is how can I creating my circle.
circle=mMap.addCircle(new CircleOptions()
.center(geoPoint
.radius(40)
.fillColor(0x12541252)
.strokeWidth(3)
.strokeColor(Color.RED));
I really will be glad, if you suggest me any way to solve my this problem..! thanks in advance!
The order in which this tile overlay is drawn with respect to other overlays (including GroundOverlays, TileOverlays, Polylines, and Polygons but not Markers). An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index is arbitrary. The default zIndex is 0.
Overlays (such as circles) with higher zIndices are drawn above those with lower indices.
You should use the method mentioned below with Circle and the ZIndex values for both the Circle should be different
public void setZIndex (float zIndex)
To get more help follow this link:
https://developers.google.com/android/reference/com/google/android/gms/maps/model/Circle.html#setZIndex(float)

Add map overlay from drawable that spans entire map

I have an Android mapview (using Xamarin) that contains two collections of markers, one for property markers and the other for traffic count markers. I need to add a translucent overlay to the map in between the two collections of markers, so that the traffic count markers are above it and are alpha = 1, and the property markers and map tiles are below it and are alpha = .5.
This doesn't seem like it should be too tricky, but I haven't found any examples online of how to create an overlay of a drawable (a translucent 1x1 pixel png image) and stretch it across the map.
My best guess is that I need to use a tile overlay... I saw that there is a UrlTileProvider but that's for loading a url, not a drawable. Also there is the option of implementing ITileProvider directly, however I couldn't figure out how to do it.
Any help would be appreciated!

How do I change polygons form without lag?

I have a Google map were I draw rectangles.
I have a draggable marker that makes the rectangle change is size as you move your finger.
I do polygon.remove and then create a new polygon with new points (one of the corners is the marker position and I calculate the others)
The resize is working, but the problem is that graphics are slow, you can see the polygon dissapear and reappear.
Is it because of a hardware limitation or there's another better approach?
From the documentation of Google Maps Android API, it is stated in the Polygon part here that to alter the shape of the polygon after it has been added, you can call Polygon.setPoints() and provide a new list of points for the outline of the polygon.
So you must update the shape by calling Polygon.setPoints() rather than adding/removing it.
For more information, just check the link above.

How to set transparent parts/change color of map polygon on Android?

I have created several polygons over google map which are filled with color
Polygon polygon = mMap.addPolygon(opts.strokeColor(Color.WHITE).strokeWidth(2).fillColor(Color.RED));
I know how to set transparent whole polygon but is is it possible to set transparent only parts of it(change color)?
The idea is, when the user touches the parts of polygon they are set transperent, something similar to this:
Erase bitmap parts using PorterDuff mode
But this example is used for DrawingViews and bitmaps, not for maps and polygons.

Google Maps API v2 for Android: Cannot draw like deprecated Overlay

I have developing an Android application, and I have moved from Google Maps for Android API v1 to v2.
With deprecated version 1 I created an Overlay for drawing some colored shapes (delimiting zones) and info text over my map, but now I have been viewing API v2 and cannot do the same.
I have trying to use Polygon property, but it doesn't fill with any colour, maybe because my shapes cannot be drawing in counterclockwise due to the pattern of them, for example a shape with 'U' pattern. Also, I don't know either how to put a text (no marker, just text) over the map.
Thanks in advance.
still don't know how to put a text in the map
Create a Bitmap containing your text, and use a GroundOverlay, or possibly a TileOverlay.

Categories

Resources