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

  • Home
  • SEARCH
  • 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 8238919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:58:17+00:00 2026-06-07T19:58:17+00:00

I’ve been stuck on this for a while now, and though I found a

  • 0

I’ve been stuck on this for a while now, and though I found a workaround I don’t quite understand why it works and I should to implement it properly! There also seems to be a dearth of information on the ZoomButtonsController out there.

Per other articles here, I’ve implemented “swipe” gesture functionality in my app. However, on a single tap, I also wanted the zoom buttons to appear programmatically. I had the GestureDetector-based OnTouchListener already for this ScrollView, and so I added a ZoomButtonsController as the OnZoomListener for it as well (along with code to handle onSingleTapConfirmed and other such things).

Things worked fine – until the zoom buttons appeared. From that point forward (assuming constant visibility), no gestures work, not even tapping, even after the zoom buttons fade away! You can click the zoom buttons while they are onscreen and scroll still works fine but the gestures are gone.

I finally came up with a “fix”: if OnZoomListener.onVisibilityChanged() fires to invisible I call myScrollView’s setOnTouchListener() to restore the gestureListener (like I did in onCreate()). The gestures work fine again.

Edit: if you do this when onVisibilityChanged() fires to visible, you get gestures working right away BUT it disables the zoom buttons so it’s not that great! It’d be nice to have both…

So, is what I’m doing the right way to use ZoomButtonsController and if not, what is? More importantly, why is it when the zoom buttons appear they seem to replace my OnTouchListener permanently? Is ZoomButtonsController supposed to hijack the gestures currently after it fires? Is this somehow more basic than that (some general property of listeners)?

  • 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-07T19:58:19+00:00Added an answer on June 7, 2026 at 7:58 pm

    I’ve struggled with this issue for a while before I’ve found a solution. I’m not sure if it’s the most correct one, but it’s functioning perfectly.

    Concept:

    1 – Don´t add the ZoomButtonsController widget directly to the view where you need them. The onTouch events will conflict. Instead, you need to add the ZoomButtonsController widget to a new view and add this view to the same layout where is the view you want to add the zoom buttons to.

    2 – The view where the ZoomButtonsController have been added must be the last being added to the parent layout. This way it will be the first being called, and if the zoom buttons are not pressed the onTouch event is passed to your view for you to process.

    Code with example:

        //First my view where I need the zoom buttons
        imageView = new ImageView(context);
        LayoutParams layoutParams = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
        imageView.setLayoutParams(layoutParams);
        imageView.setOnTouchListener(onTouchListener);
        relativeLayout.addView(imageView);
    
        //Secondly the view where the buttons are added     
        View zoomView = new View(context);
        LayoutParams layoutParamsZoom = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        zoomView.setLayoutParams(layoutParamsZoom);
        relativeLayout.addView(zoomView);
        zoomButtonsController = new ZoomButtonsController(zoomView); 
        zoomButtonsController.setOnZoomListener(onZoomListener);
    

    Finally, you just need to add the listener to the zoom widget:

    ZoomButtonsController.OnZoomListener onZoomListener = new ZoomButtonsController.OnZoomListener() {
    
        @Override
        public void onZoom(boolean zoomIn) {
            Log.d(TAG, "onZoom: " +  zoomIn);
            if(zoomIn){ 
                setZoom(currentZoom +1); 
            }else{ 
                setZoom(currentZoom -1); 
            } 
        }
    
        @Override
        public void onVisibilityChanged(boolean visible) {
            // TODO Auto-generated method stub
        }
    };
    

    Good luck,
    Luis

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm parsing an XML file, the creators of it stuck in a bunch social

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.