I have a scroll view in my main activity and inside, I have a fragment with google map..
When I scroll down and reach the google map window, I try to move the map inside it, but when I push it up, it doesn't move the map inside, but all the scrolling view..
I would like to ask if there is any way to focus on the google map window and when I try to do some gestures inside it, the scrolling view doesn't effected!
To sum up: I have a scrolling view with a google map fragment, I can move left and right, but not up or down, on the map, because all the page moves up and down with the scrolling view
Thank you!!
MainActivity.java
try {
if (googleMap == null) {
googleMap = ((MapFragment) getFragmentManager().
findFragmentById(R.id.map)).getMap();
}
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
// Turns traffic layer on
googleMap.setTrafficEnabled(true);
// Show Zoom buttons
googleMap.getUiSettings().setZoomControlsEnabled(true);
// Create a marker in the map at a given position with a title
Marker marker1 = googleMap.addMarker(new MarkerOptions().
position(first).title("place"));
CameraUpdate center=
CameraUpdateFactory.newLatLng(new LatLng(0, 0));
CameraUpdate zoom=CameraUpdateFactory.zoomTo(9);
googleMap.moveCamera(center);
googleMap.animateCamera(zoom);
googleMap.getUiSettings().setScrollGesturesEnabled(true);
} catch (Exception e) {
e.printStackTrace();
}
activity_main.xml
< fragment
android:id="@+id/map"
class="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_below="@+id/contact"
android:layout_marginBottom="20dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />