2

I have a ViewPager with more pages and on every page is LineChart (width = match_parent). If user scrolls to the end of the first chart, next when he scrolls again I want to start showing the next chart (like ViewPager change page). But if the user is in the middle of the chart then he should scroll only in the chart itself (not between pages in the ViewPager).

I'm trying override onInterceptTouchEvent() and onTouchEvent() of the ViewPager but it still not working good...

I also found this: https://github.com/PhilJay/MPAndroidChart/issues/1885 but there is not a solution...

Do you have some suggestion?

Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69

1 Answers1

0

You should disable viewpager scroll view and use gesture detector for swipe left and right. MPAndroidchart have builtin horizontal scroll for line chart try its listener.

unzila
  • 190
  • 1
  • 12
  • Can you send me some example? How should I disable viewpager scroll view? Please try to provide more info. – Pepa Zapletal Jul 19 '18 at 12:02
  • For diabling view pager skype try this link https://stackoverflow.com/questions/9650265/how-do-disable-paging-by-swiping-with-finger-in-viewpager-but-still-be-able-to-s – unzila Jul 20 '18 at 03:24