Tutorials Android How to add zoom controls to Android MapView

How to add zoom controls to Android MapView

The following code snippet shows how to add zoom controls to Android MapView. We can achieve this by calling setBuiltInZoomControls(boolean) method.

MapView map = (MapView)findViewById(R.id.mapview);
map.setBuiltInZoomControls(true);

The above code snippet will add the zoom controls to the bottom-center of the MapView. The zoom controls only show up when you touch the screen, so you have to make sure that the map is clickable.

<com.google.android.maps.MapView
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:id="@+id/mapview"
       android:clickable="true"
       android:apiKey="your key">
</com.google.android.maps.MapView>
Total
0
Shares
guest
0 Comments
Inline Feedbacks
View all comments
Previous Post

Upload image to a web service using HttpURLConnection

Next Post

How to access accelerometer in Android

Related Posts
By clicking “Allow All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Notice
Allow All
0
Would love your thoughts, please comment.x
()
x