Swipe/Fling tab-changing in conjunction with ScrollView?

后端 未结 3 1804
栀梦
栀梦 2020-12-02 10:03

The best I could find on this particular issue (although I do not use a Gallery): ScrollView and Gallery interfering - doesn\'t really give a specific answer though. And my

相关标签:
3条回答
  • 2020-12-02 10:37

    In looking to solve a similar issue I am having, I came across this tid-bit:

    eventsInterceptionEnabled: when set to true, this property tells the overlay to steal the events from its children as soon as it knows the user is really drawing a gesture. This is useful when there's a scrollable view under the overlay, to avoid scrolling the underlying child as the user draws his gesture

    From the Android Dev site, it talks about using this attribute in the <android.gesture.GestureOverlayView> Root in your layout file.

    0 讨论(0)
  • 2020-12-02 10:45

    I would suggest you have a look at the Google I/O 2010 app source code, as their FlingableTabHost implementation would appear to have solved this problem:

    http://iosched.googlecode.com/svn/trunk/src/com/google/android/apps/iosched/ui/ScheduleActivity.java

    I think the key is in extending TabHost and overriding its onInterceptTouchEvent method.

    0 讨论(0)
  • 2020-12-02 10:56

    For what it's worth, I found the onFling method very unreliable. I override the onScroll method in the SimpleGestureDetector, and define my onInterceptTouchEvent as:

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        //Call super first because it does some hidden motion event handling
        boolean result = super.onInterceptTouchEvent(ev);
        if (this.mGestureScanner.onTouchEvent(ev)) return true;
        return result;
    }
    
    0 讨论(0)
提交回复
热议问题