Basically, my app will function a bit like Pokemon Go. I'm using mapsforge and offline maps. At the moment the app allows auto rotate(fine), tapping(fine) and map movement, like dragging or scrolling(not sure which event does that).
I just need the app to not allow dragging/scrolling of the map. Everything else should be allowed.
Any insight would help.
You can have a view on the top of your map.
That View can handle all touch events and do not give it to the map.
Related
I've got a Mapbox map working with custom markers. I've got an issue in that when I'm interacting with the map, regardless of type (zoom, pan, tilt etc) and number of fingers used, if one finger starts on a marker then that event will not work. The marker click listener doesn't get called, so it seems that the marker isn't consuming the event. I'd added logging to the other event listeners on the Mapbox view and none of them are being called either (OnCameraChangeListener, OnMapClickListener, OnScrollListener, OnFlingListener etc)
Debug mode on the Mapbox view is enabled.
The problem is that we have a lot of markers in a very small area, and it's almost impossible to manipulate the map.
We are working on a fix for this, you can track the progress here. One thing to note is that the fix most likely will break a few APIs in the SDK which means the fix won't make it till the 5.0 release of the Mapbox Android SDK. Hope this helps!
How do I disable a new pin being dropped when a user touches the map? This seems like this should be obvious, but I can't find it anywhere! Basically map comes up with my custom pins, user touches anywhere on the screen, a dummy pin appears and mine disappear.
You might want to change the draggable(boolean) function in markerOptions, you can set the draggable to be false.
For more information about a draggable market, you can visit this documentation.
I'm dumb. I got a little copy and paste happy and had that as part of a listener.
I have a maps application using the new v2 Google Maps API for Android. What I am trying to do is allow the user to draw a line on the map that follows the path of their finger. I understand I will probably need a button to enable/disable this functionality as it would obviously need to disable the pan/zoom controls. Once a user draws their line I need to be able to join the ends up to form a polygon. Does anybody know how this can be done? Really appreciate any help!
I think you could achieve this by using a framelayout that overlays a view above the map fragment. Listen for touch events on that view and set it's visibility to GONE once the user wants to disable the drawing so it wont fire your touch listeners and instead fire the maps ones.
An alternative would be to use a marker instead of allowing freeform drawing, you can easily listen for marker drag events and draw lines when the drag events finish.
Closing the polygon would be as easy as drawing a line from the start to the last line's end.
This will allow you to raw on the map https://developers.google.com/maps/documentation/android/lines
move the pin to front when we click on pin in map please suggest any solution to do this
Best answer: Write your own Overlay to have this capability.
Possible answer: Play around with the order of the OverlayItems in your ItemizedOverlay. That may control which is "on top", but I am not completely certain. And, since that behavior is not documented, it might change in the future.
I'm developing an Android application where I want to pin out certain spots/addresses on a google map. I have managed to add point to a mapView using OverlayItem and a Drawable. That works great.
But I have installed an application where the pins/spots are added asynchronously, and it looks like they are dropped from the top of the screen on to the map. Looks really nice.
I think I can manage to code the async functionality using threads, but I have no idea how to implement the "falling" feature... Does anyone have a clue??
That would seem difficult, unless the map were stationary.
If the map won't be panning/zooming, you could do the "falling" via a TranslateAnimation, applied to an ImageView that floats above the map (e.g., later child in the RelativeLayout that holds the MapView). When the animation completes, you'd make the ImageView be View.GONE, and you'd add the actual marker to the ItemizedOverlay.
Here is a sample project showing how to do drag-and-drop of an OverlayItem using a similar core concept.