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 6569417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:37:27+00:00 2026-05-25T14:37:27+00:00

I have a viewflipper which includes a number of layouts. Each layout has a

  • 0

I have a viewflipper which includes a number of layouts. Each layout has a scrollview as the root.

Below the viewflipper I have a horizontal scrollview which contains textviews which acts as a navigation bar.

My original issue was that the fling stopped working as soon as I added a scrollview but I added the following code:

    @Override
public boolean dispatchTouchEvent(MotionEvent ev){
super.dispatchTouchEvent(ev);
return gestureDetector.onTouchEvent(ev);
} 

And the scrolling now works along with the fling.

The only issue I have now though is that the HSV nav bar now acts a little strange. Sometimes when I try to slide it across, to select new contents, the HSV springs back to where it was. Other times the HSV thinks I want to fling and moves to the next contents. This is of course dependant of the speed I try to scroll it.

I want the nav bar to work independently of the flipper.

I’m trying to understand the code to fix it myself but not getting anywhere.

I have the following in my onCreate:

gestureDetector = new GestureDetector(new MyGestureDetector());
gestureListener = new View.OnTouchListener() {
    public boolean onTouch(View v, MotionEvent event) {
        if (gestureDetector.onTouchEvent(event)) {
            return true;
        }
        return false;
    }};

I have the MyGestureDetector class:

class MyGestureDetector extends SimpleOnGestureListener {
    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        try {
            if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
                return false;
            // right to left swipe
            if(e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                flipper.setInAnimation(flip_in_from_right);
                flipper.setOutAnimation(flip_out_to_left);
                flipper.showNext();

            }  else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE && Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
                flipper.setInAnimation(flip_in_from_left);
                flipper.setOutAnimation(flip_out_to_right);
                flipper.showPrevious();

            }
        } catch (Exception e) {
            // nothing
        }

And then the override:

    @Override
public boolean dispatchTouchEvent(MotionEvent ev){
super.dispatchTouchEvent(ev);
return gestureDetector.onTouchEvent(ev);
} 

Can anyone shed any light on this?

  • 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-05-25T14:37:28+00:00Added an answer on May 25, 2026 at 2:37 pm

    Where exactly is your HSV? Is it pinned to the bottom of the screen? If so, here’s what I would do. Within your onFling event, check the Y position of the fling and make sure it’s not within your HSV. If it is, then return false and you should be good to go.

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

Sidebar

Related Questions

I have a ViewFlipper which contains a few linear layouts. I need to allow
I have add a ViewFlipper in which has 2 linearlayout,and I have made an
I have a ViewFlipper in which I want to add Views (Relative Layout with
In my application I have an activity which contains a viewflipper with 3 listviews
I have three layouts with viewflipper. I want one layout to be able to
Developing in Android 2.1, I have a ViewFlipper layout with 3 includes and I
I have a viewFlipper which flips between many textViews. For some reason the views
I have a ScrolLView that wraps a ViewFlipper. The content in the ViewFlipper is
I have a ViewFlipper loaded with ImageViews (about 24) which are screenshots for the
I have a ViewFlipper implementation that needs to be improved. This ViewFlipper has three

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.