I'm developing an application in which i have to show a map with the aim on it. just like it is on the picture. When a user drags map with a finger, map is moving and the aim isn't. I can make a translucent layout over the map, but can't understand how to draw a transparent circle. Please give me some ideas. Thanks!
I suppose it depends how you're drawing the translucent overlay, but if you were using Canvas methods, you can try with the clip methods to intersect with a path. http://developer.android.com/reference/android/graphics/Canvas.html#clipPath(android.graphics.Path)
Related
i need to overlay many (clickable) polygons on the map (over 5000), so the normal Polygon overlay is slow in performance.
My idea is to create a custom bitmap overlay, drawing on a bitmap canvas only polygons that are inside current bounding coordinates, ignoring all drawing for polygons outside.
Moreover i would to redraw the overlay only when the user has finished to zoom or panning, not during this operation, for performance reasons.
Can someone please point some help to me?
Thanks.
In your case, Bounding box test is a good solution when a lot of polygons are completely outside the viewbox.
You can subclass the Polygon, add a bounding box attribute, and override the draw method to first test if this bounding box is completely outside the viewbox.
No need to draw on a bitmap canvas.
Now, if the user zoom-out, he will have all polygons inside the viewbox: back to the initial issue... A solution could be to handle levels of details. Maybe using the DouglasPeucker reducer (available in OSMBonusPack utils).
I have a particular need with a mapView and i can't find any good solution.
I have a Mapview with some markers displayed on it, and it works perfectly.
My need is that i want to put a kind of layer/background on the screen, in order to "mask" the map, but i always want to see the markers, and keep all the mapview functionnalities (zoom, move, etc.)
Is there any solution available to do it?
I hope you understand my need.
Many thanks in advance.
Create an overlay that mask (cover) the part of the map that you want to cover. In the onDraw() of this oevrlay just draw something that achive your mask requirements (areas, colors and opacity).
To ensure that markers are always visible, you need to add the overlay with markers after you add the overlay that mask map to the mapView.getOverlays.add().
Enjoy it.
I am new to android. I am working on a project which uses map. I want to draw an overlay item on a specific geopoint which contains a rectangle, some location info and a button which makes the overlay invisible when clicked. I can draw rectangle and text using drawRect() and drawText() in the draw method of overlay. The problem is that how to draw a button as a part of overlay which is clickable or something like that. Can anybody suggest something...???
Read the following links and download the code in the links
https://github.com/jgilfelt/android-mapviewballoons
https://github.com/jgilfelt/android-mapviewballoons#readme.
it really working nice to display button on the map.
I am developing an application which makes use of google map. I have some overlays added to show location of certain places. These overlay items can tap to get more information. I followed the link How to show a balloon above a marker in a MapActivity? Isn't there a widget? to achieve. Besides, I need to show some animation around the overlay item to show that it is being selected.
I have one idea which is to draw some circles(just stroke, without fill) simultaneously one after another. Start from small circle with thicker stroke to big circle with thinner stroke. When the second circle is drawn, the first circle should disappear. It would be like circle gradually growing (ripple effect) . Of course, it would disappear and start the process over again.
I am having trouble with drawing circles on the mapview. Is it just another overlay or something else? I would be grateful if anyone could show me similar thread or recommendation. Any suggestion are welcome too.
I have balloon popups showing in Android MapView when a user tap:s on specific points on the map. Depending on where the user taps the balloon does not always fit insize the MapView. I solve this now by using MapController.animateTo to always have the tapped point in center. However, this is not the way I prefer it to be. I would like to animate the MapView only so much that the balloon layout fits inside MapView.
Any tips on how this can be solved?
One way to fit the balloon overlay is to override the dispatchDraw method, check the bounds of the display using getMeasuredWidth and getMeasuredHeight, and, draw the balloon such that it fits within the display area.
I am not sure if you have seen the Android MapView Balloons project on github. I have been using this code for a while and it is excellent, may be you can find some pointers to your problem from there.
Hope this helps.