MJakhongir
MJakhongir

Reputation: 3008

Yandex Mapview inside ScrollView not scrolling vertically

The mapview only scrolls sideways, as if you try to scroll vertically the ScrollView is taking the action. I've tried requestDisallowInterceptTouchEvent(true); but it didn't help.

PS. Yandex MapView extends RelativeLayout

Upvotes: 0

Views: 623

Answers (1)

Hantash Nadeem
Hantash Nadeem

Reputation: 488

You have to create custom MapView. Follow the code snippet provided below

public class AppMapView extends MapView {

    public AppMapView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        switch (ev.getAction()) {
            case MotionEvent.ACTION_UP:
               System.out.println("unlocked");
               this.getParent().requestDisallowInterceptTouchEvent(false);
               break;

            case MotionEvent.ACTION_DOWN:
               System.out.println("locked");
               this.getParent().requestDisallowInterceptTouchEvent(true);
               break;
       }
       return super.dispatchTouchEvent(ev);
   }
}

Upvotes: 1

Related Questions