Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8853061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:33:24+00:00 2026-06-14T13:33:24+00:00

As I mentioned on title, app has a ScrollView and a GestureDetector too. Outside

  • 0

As I mentioned on title, app has a ScrollView and a GestureDetector too. Outside of ScrollView’s touch events, GestureDetector handling swipe actions like left to right and right to left. They’re all working well.

Now I want to add a GestureLibrary -I mean raw- to Activity. I’ve looked different sources and somehow added properly. Simply, layout looking like this:

<android.gesture.GestureOverlayView
    android:id="@+id/gOverlay"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ScrollView 
        android:id="@+id/content_scroll"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scrollbars="none">

            </ScrollView>
            <!-- Other views -->
</android.gesture.GestureOverlayView>   

It’s drawing as I wanted (the yellow line) but it’s not triggering any methods. Here how I implemented OnGesturePerformedListener:

    /*
     * Gestures
     */
    gLibrary = GestureLibraries.fromRawResource(this, R.raw.gestures);
    if (!gLibrary.load()) { finish(); }
    GestureOverlayView gestureOverlayView = (GestureOverlayView) findViewById(R.id.gOverlay);
    gestureOverlayView.addOnGesturePerformedListener(gestureListener);  

And here is gestureListener:

private OnGesturePerformedListener gestureListener = new OnGesturePerformedListener() {
    public void onGesturePerformed(GestureOverlayView overlay, Gesture gesture) {
        ArrayList<Prediction> predictions = gLibrary.recognize(gesture);            
        if (predictions.size() > 1) {
            for(Prediction prediction: predictions){
                Log.d("Test", "Looking for gestures");
            }
        }
    }
};

That’s all. By the wall, I tried this source code with in different Activity which has no ScrollView and working fine.

Finally, I’m not sure is it about GestureDetector, so that’s how app using detector:

public boolean dispatchTouchEvent(MotionEvent ev) {
    if (detector != null) {
        if (detector.onTouchEvent(ev)) {
            return true;
        }
    }
    return super.dispatchTouchEvent(ev);
}

And my SwipeDetector:

private class SwipeDetector extends SimpleOnGestureListener {
    private static final int SWIPE_MIN_DISTANCE = 120;
    private static final int SWIPE_MAX_OFF_PATH = 250;
    private static final int SWIPE_THRESHOLD_VELOCITY = 200;
    public boolean onFling(android.view.MotionEvent e1, android.view.MotionEvent e2, float velocityX, float velocityY) {
        if( Math.abs( e1.getY() - e2.getY() ) > SWIPE_MAX_OFF_PATH ) { return false; }
        if( e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs( velocityX ) > SWIPE_THRESHOLD_VELOCITY ) { return false; }
        if( e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs( velocityX ) > SWIPE_THRESHOLD_VELOCITY ) {  filterButton.performClick();return true; }          
        return false;
    }
}

What’s wrong with my approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:33:25+00:00Added an answer on June 14, 2026 at 1:33 pm

    All touch events in android goes from children to parents. So, scroll view handle all touch events, and you gesture detector does not receives them. You can set touch listener on ScrollView:

        scrollView.setOnTouchListener(new OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (detector != null) {
                    return detector.onTouchEvent(event);
                return false;
            }
        });
    

    You have to check that scroll works as necessary, and you don’t consumed scroll events.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Like the topic title mentioned. I'm trying to make an app (for iPhone) that
As the title mentioned, I have developed a simple NFC app in eclipse and
As mentioned in the title, I have an app and when the auth dialogue
I get the error mentioned in the title when I run my app on
Sorry for the rather ambiguous title but I'm developing a Sencha Touch mobile app
As the title mentioned, I want to encode a Image Obj into some kind
I am bit confused, as my title mentioned, Is id in Objective C is
As mentioned in the title, my launcher icon is showing up fine on the
Would what mentioned in the title be possible? Python module style that is. See
As I have mentioned in the title, my dispatch_async is firing 10 times. And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.