خرید بک لینک

Vote count: 0

I have a ListView where I add a Google Map MapView into the header view, below is the code on how I do that:

vListViewTrips.addHeaderView(vMapHeaderView, null, false);

The map is shown and works but the map does not handle any gestures when its being touched even though all gestures are anebled by: googleMap.getUiSettings().setAllGesturesEnabled(true);

Based on some searches that I did I tried to extend MapView and override the public boolean dispatchTouchEvent(final MotionEvent motionEvent) but still the onTouchEvent of the MapView is never called.

Here is the code:

@Override
public boolean dispatchTouchEvent(final MotionEvent motionEvent) {

    System.out.println("asfdasfdgsafd");
    ViewParent viewparent = getParent();
    switch (motionEvent.getAction()) {
        // Pressed on map: stop listview from scrolling
        case MotionEvent.ACTION_DOWN:
            viewparent.requestDisallowInterceptTouchEvent(true);
            break;

        case MotionEvent.ACTION_MOVE:
            viewparent.requestDisallowInterceptTouchEvent(true);
            break;

        // Released on map or cancelled: listview can be normal again
        case MotionEvent.ACTION_UP:
            viewparent.requestDisallowInterceptTouchEvent(false);
            break;
    }

    return super.dispatchTouchEvent(motionEvent);
}

Note im using com.google.android.gms.maps.MapView

asked 20 secs ago

برچسب: android mapview in fragment,android mapview in recyclerview,android mapview in dialog,android mapview in listview,android mapview inside linearlayout,android mapview in scrollview,android mapview inside fragment,android mapview inside activity,android mapview inside listview, نویسنده: استخدام کار تاريخ: سه شنبه 2 شهريور 1395 ساعت: 16:16

صفحه بندی