0

I have a ViewPager with two different Fragments into another Fragment (I am using NavigationBar). Into the first Fragment of my ViewPager I have a particular view (a scrollable android chart made by MP Android Chart) which has to be navigated horizontally by swipes. I want to disable the swype of the Fragment during the swype of this view, is that possible?

EDIT

I am using such a class to extend the ViewPager:

public class Cl_ViewPager extends ViewPager {

    private boolean isPagingEnabled = true;

    public Cl_ViewPager (Context context) {
        super(context);
    }

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

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        return this.isPagingEnabled && super.onTouchEvent(event);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        return this.isPagingEnabled && super.onInterceptTouchEvent(event);
    }

    public void setPagingEnabled(boolean b) {
        this.isPagingEnabled = b;
    }
}

But what I want to achieve is: disable the swipe IF the swipe is done within a certain view (my chart). So far anything helped me.

Soul
  • 590
  • 1
  • 7
  • 17
  • https://stackoverflow.com/questions/8594361/horizontal-scroll-view-inside-viewpager – ADM Mar 20 '18 at 19:04
  • I edited the question, this is quite tricky as I am working with an android linechart made with MP Android Chart – Soul Mar 20 '18 at 19:10

0 Answers0