Pages

Friday, August 12, 2016

Google Maps Android API v2 initialize map in xml

Example to initialize "com.google.android.gms.maps.SupportMapFragment" in layout xml, to set default cameraTargetLat, cameraTargetLng, cameraZoom, uiZoomControls, mapType, cameraTilt and cameraBearing.

<fragment 

android_layout_width="match_parent"
android_layout_height="match_parent" android_id="@+id/map" tools_context=".MapsActivity"
android_name="com.google.android.gms.maps.SupportMapFragment"
map_cameraTargetLat="40.689213"
map_cameraTargetLng="-74.044626"
map_cameraZoom="20"
map_uiZoomControls="true"
map_mapType="satellite"
map_cameraTilt="80"
map_cameraBearing="112.5"/>




This video show how to modify last example of "Add Marker to Google Map (Google Maps Android API v2)" to initialize map in layout xmp, layout/activity_maps.xml. In order to demonstrate on screen, I run BlueStacks App Player as Android Emulator.


Next: Detect touch on GoogleMap, onMapClick() and onMapLongClick()

~ Step-by-step of Android Google Maps Activity using Google Maps Android API v2, on Android Studio

Related Posts by Categories

0 comments:

Post a Comment