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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:20:26+00:00 2026-06-09T09:20:26+00:00

In my android application.I have a panorama view, in this view i want to

  • 0

In my android application.I have a panorama view, in this view i want to avoid only vertical scrolling. So i disabled it using onTouchEvent(MotionEvent event) method.

Hear is the code.

    @Override
public boolean onTouchEvent(MotionEvent event) {
    if( event.getAction()==MotionEvent.ACTION_UP){
        Log.d(TAG, "onTouchEvent:ACTION_UP");
        return false;
    }else if(event.getAction()==MotionEvent.ACTION_DOWN){
        Log.d(TAG, "onTouchEvent:ACTION_DOWN");     
        return false;
    }else{
        Log.d(TAG, "onTouchEvent:ACTION_UNKWON");
        return super.onTouchEvent(event);
    }

}

but it disables scrolling horizontally also.How can i solve 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-06-09T09:20:28+00:00Added an answer on June 9, 2026 at 9:20 am

    I think you misunderstood the notion of ACTION_DOWN and ACTION_UP.

    ACTION_DOWN means when your finger touches the touchscreen, ACTION_UP is when you lift your finger from the touchscreen.

    That said, you can indicate in ACTION_DOWN that the motion event started, check in ACTION_MOVE the direction of the touch event from the coordinates and decide whether you want to block the movement or not, and reset your variables in ACTION_UP.

    float startX
    float startY;   
    
    @Override
    public boolean onTouchEvent(MotionEvent event) {
    
        switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            startX = event.getX();
            startY = event.getY();
            break;
        case MotionEvent.ACTION_MOVE:
            float currentX = event.getX();
            float currentY = event.getY();
    
            float diffX = Math.abs(currentX - startX);
            float diffY = Math.abs(currentY - startY);
    
            // The purpose of the +100 is to make sure that we have a big enough
            // difference between the 2 directions, eg. it's not diagonal
            if(diffY > diffX + 100){
                return false;
            }
            break;
        case MotionEvent.ACTION_POINTER_UP:
    
            break;
        }
    
        return true;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to print file using wifi printing in my android application.I have scanned
i made android application. In application i have web view where i want to
i'm building an android application which have a chat. in this chat i each
I am using the XMPP Connection(using smack) for chat in android application.I have made
I have Android application which is Sales Rep application.When he using the app first
In android application i have a custom listview and sqlite database. I want to
In my android application I have to show the landscape view for large and
i have problem using camera in my Android application i have a form for
In my android application i have used the google map. I have using android
How can we use OCR web service in android application I have use this

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.