Limit Scrolling on offline maps, in Android

后端 未结 1 906
囚心锁ツ
囚心锁ツ 2020-12-30 16:35

I got these piece of codes or patches from osmdroid, and I decided to ask for your help guys because i don\'t have the enough knowledge to combine these codes to come up wit

相关标签:
1条回答
  • 2020-12-30 16:59

    First of all use this command on your terminal:

    svn checkout http://osmdroid.googlecode.com/svn/branches/release_3_0_5
    

    It will download a stable version

    Then follow this to import contents of the folder you downloaded:

    In Eclipse, right-click on the Package area, and select the following:

    click on Import...
    select General -> Existing Projects into Workspace
    click Next
    click Browse...
    select the checked out projects' directories
        osmdroid-android (import as a java project)
        OSMMapTilePackager (import as a java project)
        OpenStreetMapViewer (mport as an android project) 
    click OK
    click Finish
    
    1. Now open this java file--> osmdroid-android/src/org/osmdroid/view/MapView.java
    2. Now as stated in this patch file, modify MapView.java ( add code wherever + , remove code wherever -)
    3. Also modify computeScroll() in MapView.java as stated here
    4. Now, to use this modified .java file, you need to create a new jar file that you can include in your project Here is a step by step process to create jar

    5. Add this newly created jar file to your project's build path and you are ready to use your modified jar

    6. Now use this in your activity class:

      BoundingBoxE6 bbox  = new BoundingBoxE6(limit north, limit east, limit south, limit west);          
      mapView.setScrollableAreaLimit(bbox);
      
    0 讨论(0)
提交回复
热议问题