Search code examples
javaandroidosmdroid

How to disable scrolling in OSMdroid


I use OSMdroid of the version 3.0.10 in my project. And I want to disable scrolling on MapView. I tried:

setFocusable(false)
setEnabled(false)
setClickable(false)

methods of MapView with no results. Is there any way to disable scrolling the map?

Thank in advance.


Solution

  • The quickest solution is to subclass MapView and override scrollTo(). Instead of calling super.scrollTo(x,y) with the x and y parameters that were passed in, call it with the scroll values you want the maps permanently locked to.