chun8933 / osmdroid

Automatically exported from code.google.com/p/osmdroid
0 stars 0 forks source link

setBuiltInZoomControls(true) controls shown when paging #403

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Place org.osmdroid.views.MapView within a ViewPager* fragment
2. Show the controls, say by tapping on the map, and swipe to another fragment

What is the expected output?
The controls to swipe with the map.

What do you see instead?
The controls stayed in place (on the screen) and were visible over a completely 
different view / fragment until fading away.

What version of the product are you using? On what operating system?
<dependency>
 <groupId>org.osmdroid</groupId>
 <artifactId>osmdroid-android</artifactId>
 <version>3.0.8</version>
</dependency>

I worked around this by defining my own zoom controls:

    <org.osmdroid.views.MapView
        android:id="@+id/map_osm"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        cloudmadeStyle="1"
        renderer="CLOUDMADESTANDARDTILES"
        />

    <ZoomControls
        android:id="@+id/map_zoom_controls"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:paddingRight="8dp"
        android:layout_gravity="bottom"
        android:gravity="right"/>

        mZoomControls.setOnZoomInClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mMapView.getController().zoomIn();
            }
        });
        mZoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mMapView.getController().zoomOut();
            }
        });

* android.support.v4.view.ViewPager

Original issue reported on code.google.com by snodnip...@gmail.com on 18 Feb 2013 at 6:00

Attachments:

GoogleCodeExporter commented 8 years ago
This is because the zoom controls are attached to the window and not the view. 
I don't know if there is a better solution than the one you have, but maybe we 
can review the way we use the zoom controls widget.

Original comment by kurtzm...@gmail.com on 3 Apr 2013 at 10:16

GoogleCodeExporter commented 8 years ago
Zoom control should be tied to the Mapview, and not to the display.  Otherwise 
it acts as described when multiple fragment views are visible.

Original comment by MarkG...@gmail.com on 8 Dec 2014 at 4:53