3

I have implemented this https://stackoverflow.com/a/22797619/3064486 (Vertical ViewPager) in my activity. The fragments that my adapter puts inside the viewpager is having a scrollview in it.

When I reach the bottom of the scrollview it does not switch page in the viewpager. However, if I swipe from the right or left bottom corner it kind of works, it's a bit hard to explain but it jumps 20-30% of the full swipe (from page 1 to page 2) and if I immediately release it goes back and I can also swipe to continue the page switch.

I believe my scrollview is the problem here..

ViewPager

<com.mypackage.MyVerticalViewPager>

The fragment

<LinearLayout>
    <ScrollView>
       <!-- massive amount of stuff -->
    </ScrollView>
</LinearLayout>

I have tried answers here:

https://stackoverflow.com/a/14435116/3064486

Edit: I tried this https://github.com/castorflex/VerticalViewPager/blob/master/library/src/main/java/fr/castorflex/android/verticalviewpager/VerticalViewPager.java And got the vertical scroll to work. The ScrollView also works but when I get to the bottom I need to really FLING the finger to get to the other page. I guess I have to remove some kind of overscroll for the scrollView. Anyone have any idea?

Community
  • 1
  • 1
Jonas Borggren
  • 2,591
  • 1
  • 22
  • 40

1 Answers1

0

use ListView instead of ScrollView can solve this problem. since ScrollView call parent.requestDisallowInterceptTouchEvent(true) method on its onTouchEvent method, its hard to handle scroll conflicts, I am also working with this problem, I will give my solution when done.

Bruce
  • 107
  • 5
  • @JonasB I do not think fling is good user experience, how to make user know that he should fling when want to scroll to next page. – Bruce Jun 30 '15 at 02:17
  • use ListView, may be it hard for developer to make UI, but brings much better user experience. Famous app like TaoBao (have about 100million users) from Alibaba use this solution. – Bruce Jun 30 '15 at 02:19