Ad

How To Set Height And Width For MapView?

- 1 answer

Do you know about how to set coordinates (X, Y position), height and width for MapView ?

Ad

Answer

You can control what the MapView is displaying by using the MapController. You get the MapController from the MapView using getController():

MapView map = (MapView) findViewById(R.id.MyMapId);
MapController controller = map.getController();

From there, you can check the documentation on how to control the center point or span. I've found zoomToSpan() to be particularly useful.

I'm not exactly sure what you mean by "height and width" of the MapView, but if you want to change the size of the MapView itself on the screen, you can just do it like you would do for any View (by setting the layoutHeight and layoutWidth, either in xml or dynamically in code).

Ad
source: stackoverflow.com
Ad