Android : Android SupportMapFragment not panning to top and bottom of map when fragment is less than full screen

on Saturday, December 13, 2014


I need to get SupportMapFragment 300dp and centered in the screen. My problem is that when I do this the map view won't pan all the way to the top or bottom of the world. All the searching I've done hasn't produced and answer. Below I've given screenshots and the XML layout used.


Any and all help would be greatly appreciated. Thank you!




As you can see the map gets cut toward the top of Greenland because it thinks the map is full screen.


enter image description here



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"/>

</RelativeLayout>




Here is an example of it actually being full screen so that I can verify that the panning in the top example is acting as if the map is full screen.


enter image description here



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_view"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"/>

</RelativeLayout>

0 comments:

Post a Comment