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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:24:05+00:00 2026-06-11T15:24:05+00:00

I have had pinch-to-zoom working pretty well for a few application versions now using

  • 0

I have had pinch-to-zoom working pretty well for a few application versions now using Mike Ortiz’s TouchImageView and a custom TouchViewPager so that it can work inside a view pager. This was working pretty well – the only method that TouchViewPager overrides is onInterceptTouchEvent:

public boolean onInterceptTouchEvent(MotionEvent ev) {
    TouchImageView view = getTouchView();
    if( null != view ){
        if( !view.isAtLimit() && view.getCurrentScale() > 1){
            return false;
        } else {
            Log.v(TAG, "View limit = " + view.isAtLimit());
            Log.v(TAG, "View scale = " + view.getCurrentScale());
        }
    }

    return super.onInterceptTouchEvent(ev);
}

Recently, we created a new view that extends FrameLayout and manages downloading the bitmap from the internet. While the bitmap download is in progress, this layout shows a ProgressBar, and then adds the TouchImageView once it’s ready. Visually, this seems to work – we see a ProgressBar and then the TouchImageView loads – but the touches get all messed up and generally just don’t work consistently.

I’ve tried delegating onTouchEvent from the progress image view to the touch image view – no luck. I’ve also tried overriding onInterceptTouchEvent in the progress image view to always return false, and that didn’t work either.

Can anyone help with some ideas on where to continue debugging this problem? I’ve been working on this for about a week now, with little success.

This is the behavior I am seeing:

  1. Activity loads, image is visible inside the ViewPager -> FrameLayout -> TouchImageView.

  2. ViewPager works to swipe and change images, but pinch zoom does not
    work on first or second images. Eventually you get to a position
    that pinch zoom will work on. I can’t figure out what’s different.

  3. If you do try to pinch zoom before swiping, then the ViewPager swipes won’t work,
    and it will take several swipes to get the ViewPager to page.

  4. Once you are on a “working position”, swipe-to-page works fine, as
    well as pinch zoom and panning around a zoomed image. After this all positions work.

  • 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-11T15:24:06+00:00Added an answer on June 11, 2026 at 3:24 pm

    I was able to get this working, strangely, by implementing a reset method inside the TouchImageView class:

    public void resetZoom() {
        Matrix imageMatrix = getImageMatrix();
        RectF drawableRect = new RectF(0, 0, bmWidth, bmHeight);
        RectF viewRect = new RectF(0, 0, getWidth(), getHeight());
    
        imageMatrix.setRectToRect(drawableRect, viewRect, Matrix.ScaleToFit.CENTER);
    
        matrix = imageMatrix;
        setImageMatrix(matrix);
    
        fitAndCenterView();
    
        invalidate();
    }
    

    This method resets the zoom on the image when called – and when we set up the image inside the framelayout calling this gets everything set up. Oddly, this is not required when the image is not inside a FrameLayout.

    I’d of course appreciate any code cleanup and whatnot that we can do.

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

Sidebar

Related Questions

I have had overlapped IO working for 2 years now but ive used it
I have had my new rails program up for a few days now. I'm
I have had an online archive service for over a year now. Unfortunately, I
I have had this problem crop up a few times and I can't figure
I have had a few problems getting this right, so I wanted to ask
I have had some difficulties in using extended classes in rails, in particular extending
I have had a couple of questions on this issue. However, now I have
I have had this for a couple of days now. I have a simple
I have had my shared web server suspended twice now for moving large files
I have had a problem in firefox (using 10.0.2) trying to use javascript to

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.