jofomah / osmdroid

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

Views not drawn on MapView on zoom #259

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Add a custom view to the MapView component:

View customView = inflateView...
final android.view.ViewGroup.LayoutParams layout =
        new org.osmdroid.views.MapView.LayoutParams(
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                new GeoPoint(...),
                org.osmdroid.views.MapView.LayoutParams.BOTTOM_CENTER,
                0,
                0);
customView.setLayoutParams(layout);             
final MapView osmMapView = new MapView(this, 256, resourceProxy);
osmMapView.addView(customView);
osmMapView.getController().setCenter(g);
osmMapView.getController().setZoom(9);

2. Start the app and check the child view is draw correctly.
3. Zoom in. 

What is the expected output? What do you see instead?
The child view should be redrawn when zooming in. Instead the child view 
disappears and is no longer drawn. If you later call 
osmMapView.removeAllViews() and osmMapView.add(customView) then the view 
appears again.

What version of the product are you using? On what operating system?
The bug occurs with 3.0.3 and 3.0.5. The bug does not occur when the Google 
Maps API is being used instead of OSMDroid.

Help!

Original issue reported on code.google.com by dirk.hol...@gmail.com on 8 Sep 2011 at 2:33

GoogleCodeExporter commented 8 years ago
This issue can be fixed by adding a MapListener to MapView then call 
PostInvalidate after each zoom event.

Original comment by qbao.ngu...@gmail.com on 24 Oct 2011 at 8:59

GoogleCodeExporter commented 8 years ago
Adding a MapListenerwith a PostInvalidate does not solve this issue for me

Original comment by christop...@gmail.com on 31 Dec 2011 at 6:52

GoogleCodeExporter commented 8 years ago
the problem still persists in osmdroid 3.0.8

what poster #1 might have meant ist to call requestLayout() on the MapView in 
MapListener.onZoom(), not postInvalidate() which would only trigger a redraw of 
the view.

a patch for 3.0.8 is attached

Original comment by schizosfera@gmail.com on 1 Jun 2012 at 10:24

Attachments:

GoogleCodeExporter commented 8 years ago
This has been fixed by r1103. What was happening is that when you change zoom 
levels it wasn't adjusting the x,y fixed location for the added view. So the 
view would still be there, but in the wrong location. Please re-open if it is 
not fixed for you.

Original comment by kurtzm...@gmail.com on 19 Jul 2012 at 8:39

GoogleCodeExporter commented 8 years ago
@#4: the change introduced in r1103 requests a layout even if the zoom level 
doesn't change. is there a reason for that overhead?

Original comment by schizosfera@gmail.com on 20 Jul 2012 at 6:49