ZoomHelper
ZoomHelper will make any view to be zoomable just like the Instagram pinch-to-zoom.
Installation
ZoomHelper is available in the JCenter, so you just need to add it as a dependency (Module gradle)
Gradle
Maven
Usage (Kotlin)
just override dispatchTouchEvent in your Activity and pass all touch events to ZoomHelper!
And set View to be zoomable :
Or make a zoomable View by using xml layout :
Note: <tag> is only used in API level 21 and higher
And we are Done! :smiley:
Usage (Java)
Installation: you have to add kotlin as a dependency! (Module gradle)
and just override dispatchTouchEvent in your Activity and pass all touch events to ZoomHelper!
And set View to be zoomable :
Or make a zoomable View by using xml layout :
Note: <tag> is only used in API level 21 and higher
And we are Done! :smiley:
Customization
Kotlin:
Java:
you can disable a zoomable view by using this code :
Or skip a View or a ViewGroup and all its children :
And also you can disable ZoomHelper by using this code :
Check the layout is zooming currently :
Listeners :
You can add callbacks to listen for specific events.
Also the default view listeners (onClick,onLongClick,onTouch) will work as well!
Author
Amir Hossein Aghajari