I had the same problem. I turned to him by calling zoomToBoundingBox () at the end of the onLayout () method.
I have my own subclass of MapView, which I use to isolate me from choosing a map library. This class has a clearPoints / addPoint / layoutPoints interface style. In the layoutPoints () method, I create an elementary overlay layer from a collection of points and create a bounding box that is stored in the class instance method.
public class MyMapView extends MapView {
My redefinition of onLayout () has:
@Override protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { super.onLayout(arg0, arg1, arg2, arg3, arg4);
I'm not sure if this is the best way to do this, but it seems to work for me (except that the zoom seems to be too far away, but this problem is at another time).
Colin source share