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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:15:48+00:00 2026-06-14T10:15:48+00:00

I’d like to use ImageViewZoom with Universal Image Loader in ImagePagerActivity. I am able

  • 0

I’d like to use ImageViewZoom with Universal Image Loader in ImagePagerActivity.

I am able to zoom the image, Swipe to the next image. But i am facing problem when image is in Zoom position.

enter image description here

if an image is zoomed and i am at center position, if i want to see the right side part of the same image and swipe left it is going to the next image. Please help me in doing this.

here is my XML code:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:padding="1dip" >

  <it.sephiroth.android.library.imagezoom.ImageViewTouch
     android:layout_weight="1"
     android:id="@+id/image"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:scaleType="fitCenter" />

  <ProgressBar
    android:id="@+id/loading"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:visibility="gone" />

</FrameLayout>

EDIT:

Thank you NOSTRA, Now i am able to control the zoom and slide with the below code. But the problem with Multi touch zoom. I am not able to zoom with two fingers.

Here is my previous code(working fine with two finger):

public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {


        @Override
        public boolean onScale( ScaleGestureDetector detector ) {
            Log.d( LOG_TAG, "onScale" );
            float span = detector.getCurrentSpan() - detector.getPreviousSpan();
            float targetScale = mCurrentScaleFactor * detector.getScaleFactor();
            if ( mScaleEnabled ) {
                targetScale = Math.min( getMaxZoom(), Math.max( targetScale, getMinZoom()-0.1f ) );
                zoomTo( targetScale, detector.getFocusX(), detector.getFocusY() );
                mCurrentScaleFactor = Math.min( getMaxZoom(), Math.max( targetScale, getMinZoom()-1.0f ) );
                mDoubleTapDirection = 1;
                invalidate();
                return true;
            }
            return false;
        }
    }

And here is the Modified one:

public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            externalScaleListener.onScaleBegin();
                return super.onScaleBegin(detector);
        }
        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            externalScaleListener.onScaleEnd(mCurrentScaleFactor);
        }
    }
  • 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-14T10:15:50+00:00Added an answer on June 14, 2026 at 10:15 am

    First you must be able to listen scaling of image. ImageViewTouch doesn’t support this feature (e.g gesture-imageview support it) so you should implement it yourself.

    Change ImageViewTouch.java like this:

    public class ImageViewTouch extends ImageViewTouchBase {
    
        ...
    
        private OnPageScaleListener externalScaleListener;
    
        public void setOnScaleListener(OnPageScaleListener onScaleListener) {
            this.externalScaleListener = onScaleListener;
        }
    
        public interface OnPageScaleListener {
            void onScaleBegin();
    
            void onScaleEnd(float scale);
        }
    
        @Override
        protected void onZoom(float scale) {
            super.onZoom(scale);
            if (!mScaleDetector.isInProgress()) {
                mCurrentScaleFactor = scale;
                externalScaleListener.onScaleEnd(scale);
            }
        }
    
        public class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
            @Override
            public boolean onScaleBegin(ScaleGestureDetector detector) {
                externalScaleListener.onScaleBegin();
                    return super.onScaleBegin(detector);
            }
    
            ...
    
            @Override
            public void onScaleEnd(ScaleGestureDetector detector) {
                externalScaleListener.onScaleEnd(mCurrentScaleFactor);
            }
        }
    
        ...
    }
    

    Then use next implementation of ViewPager in your application:

    import android.content.Context;
    import android.support.v4.view.ViewPager;
    import android.util.AttributeSet;
    import android.view.MotionEvent;
    
    /**
     * {@link ViewPager} which can be deactivated (ignore touch events)
     * 
     * @author Sergey Tarasevich
     * @created 19.07.2012
     */
    public class DeactivableViewPager extends ViewPager {
    
        private boolean activated = true;
    
        public DeactivableViewPager(Context context) {
            super(context);
        }
    
        public DeactivableViewPager(Context context, AttributeSet attrs) {
            super(context, attrs);
        }
    
        public void activate() {
            activated = true;
        }
    
        public void deactivate() {
            activated = false;
        }
    
        @Override
        public boolean onInterceptTouchEvent(MotionEvent event) {
            if (activated) {
                try {
                    return super.onInterceptTouchEvent(event);
                } catch (Exception e) { // sometimes happens
                    return true;
                }
            } else {
            return false;
        }
        }
    
        @Override
        public boolean onTouchEvent(MotionEvent event) {
            try {
                return super.onTouchEvent(event);
            } catch (Exception e) {
                return true;
            }
        }
    }
    

    Then in your ViewPager’s adapter you should set next scale listener for your ImageViewTouch:

    ImageViewTouch imageView = ...;
    imageView.setOnScaleListener(new OnPageScaleListener() {
        @Override
        public void onScaleBegin() {
            viewPager.deactivate();
        }
    
        @Override
        public void onScaleEnd(float scale) {
            if (scale > 1.0) {
                viewPager.deactivate();
            } else {
                viewPager.activate();
            }
        }
    });
    
    imageLoader.displayImage(url, imageView, ...);
    

    And don’t forget set big values for maxImage***ForMemoryCache in ImageLoader’s configuration so UIL won’t downscale original images during decoding to Bitmaps:

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
            ...
            .memoryCacheExtraOptions(3000, 3000)
            ...
            .build();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

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.