0

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" />
GIRIDHARAN
  • 169
  • 1
  • 1
  • 14
ni gi
  • 75
  • 1
  • 10
  • Your question is a bit similar to [this ticket](http://stackoverflow.com/questions/6546108/mapview-inside-a-scrollview) (as well as a requirement I did on my last project). The solution offered solved it for me, hope this is also the case on your's. The other answers also contains other alternatives on how to approach the issue. – adjuremods Jan 05 '16 at 03:41
  • Thank you for the response.. I try your way and put your code into my MainActivity.java under the onCreate but it cannot resolve the "requestDisallowInterceptTouchEvent" method. Can you help me?? – ni gi Jan 07 '16 at 15:49

0 Answers0