Android Question Osmdroid and zoom control

warwound

Expert
Licensed User
Longtime User
Hi.

I've taken a look at the source code for OSMDroid and it is not possible to re-position the zoom buttons.
The zoom buttons are within a FrameLayout in a class that is not exposed to the library methods.

Your only option i think is to not display the built in zoom controls but create your own custom zoom buttons.

Martin.
 
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Your only option i think is to not display the built in zoom controls but create your own custom zoom buttons.
Tanks Martin
It 'just what I've done (see attached image).
But now I have to manage the touch on MapView when the map is moved
 

Attachments

  • Martin.jpg
    Martin.jpg
    59.7 KB · Views: 503
Upvote 0

AlpVir

Well-Known Member
Licensed User
Longtime User
Yes, I two buttons (Zoom+ and Zoom-) should behave exactly like those of the your "zoom control".
In addition there is a "C" button (top left) which should center the map.
The navigator TwoNav has just these 3 buttons that disappear when the map stops and they appear when it is moved.
Actually, for some reason unknown to me now, the event ZoomChanged and is not trapped ZoomChanged. the code
B4X:
Sub MapView1_ZoomChanged
    Log("MapView1_ZoomChanged")
    LbZoom.Text = "Z"&CStr(MapView1.Zoom)
End Sub
is not executed (MapView1 is declared in Sub Globals)
???
Maybe everything would be resolved if we could intercept the event MapView1_Move (which does not exist !)
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Hi again.

If the ZoomChanged event is not being raised then first check that you are passing the correct EventName to the MapView Initialize method.

There is no MapView Move event but there is a MapView CenterChanged event, this event is raised when the map is scrolled.
I think this event is raised continuously while the map is being panned/scrolled and not raised just once when the pan/scroll ends.

Can you try to listen for the CenterChanged event?

If neither of these events are raised we'll have to debug you code.

Martin.
 
Upvote 0
Top