Comments (8)
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.
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.
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.
Take a look at this:
from imageviewzoom.
@femosso : Thats not what I meant. How do I know user reached to max bound ?
from imageviewzoom.
did you solve this problem , i have this too !
from imageviewzoom.
Nope, I used the above method.
from imageviewzoom.
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)
- Image initial jumping HOT 1
- This view intercepts all touch events HOT 1
- How To Lock ImageView (enable / disable zoom and panning function in imageview)
- How to get coordinates (pixels area) of points in an image
- Openharmony application
- MinZoom not working HOT 1
- How to disable one finger zoom
- FIT_TO_SCREEN + double tap HOT 1
- How to using this library on ListView HOT 1
- demo code is not working for me please help
- How to initially set zoom in for image view programatically
- Set scroll to top
- MIN SDK HOT 3
- minSDK version changed to 16? HOT 2
- Feature Request: On Image Matrix Changed Listener HOT 1
- Neither margins nor paddings work properly. HOT 1
- Padding problem
- minSDK 16 in build.gradle but manifest is 9 HOT 1
- When attempting to zoom/pan my images becames small and non-movable (VIDEO)
- not able to save image using this imageview why?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imageviewzoom.