Code Monkey home page Code Monkey logo

Comments (8)

saishneugi avatar saishneugi commented on September 27, 2024 1

I know this is a very old post but i couldnt find a solution else where other than this so if anyones der please respond.@cargo8 solution works fine but the getScale() method seems to be deprecated in the present versions of android. So i used getScaleFactor() method. But it returns value as 1.0 however your resize your image. How can we check the actual scale value of the image?

from imageviewzoom.

cargo8 avatar cargo8 commented on September 27, 2024

You should extend the ImageViewZoom with your own ImageView subclass. Then try something like this:

this.setOnTouchListener(new OnTouchListener() {
@OverRide
public boolean onTouch(View v, MotionEvent event) {
if (getScale() > 1f) {
getParent().requestDisallowInterceptTouchEvent(true);
} else {
getParent().requestDisallowInterceptTouchEvent(false);
}
return false;
}
});

This should basically disallow paging whenever the image is scaled/zoomed beyond 1x. Thus, the user must zoom out in order to page.

from imageviewzoom.

xmenxwk avatar xmenxwk commented on September 27, 2024

Thank you, thats a good idea, but is it possible to do without zoom out, I mean when it reaches the max bound, let the parent allow.

from imageviewzoom.

femosso avatar femosso commented on September 27, 2024

Take a look at this:

http://stackoverflow.com/questions/14764603/how-to-intercept-touch-events-from-viewpager-onpagechangelistener

from imageviewzoom.

xmenxwk avatar xmenxwk commented on September 27, 2024

@femosso : Thats not what I meant. How do I know user reached to max bound ?

from imageviewzoom.

whgreate avatar whgreate commented on September 27, 2024

did you solve this problem , i have this too !

from imageviewzoom.

xmenxwk avatar xmenxwk commented on September 27, 2024

Nope, I used the above method.

from imageviewzoom.

RaidenX5 avatar RaidenX5 commented on September 27, 2024

Try this :

imageviewtouch.setOnTouchListener(new View.OnTouchListener() {
@OverRide
public boolean onTouch(View view, MotionEvent motionEvent) {

            switch (motionEvent.getAction()) {
                case MotionEvent.ACTION_DOWN:
                    Log.d("touchme", "down");
                    view.getParent().requestDisallowInterceptTouchEvent(true);
                    //view.requestDisallowInterceptTouchEvent(true);
                    break;
                case MotionEvent.ACTION_CANCEL:
                case MotionEvent.ACTION_UP:
                    Log.d("touchme", "up");
                    view.getParent().requestDisallowInterceptTouchEvent(false);
                    //view.requestDisallowInterceptTouchEvent(false);
                    break;
                default:
                    break;
            }
            return false;
        }
    });

This will disable scrollview for taking touch event from imageviewtoich if the imageviewtouch still getting touch, will enable scroll on parent after imageviewtouch not receiving touch.

from imageviewzoom.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.