Android ImageView widget with zoom and pan capabilities

Overview

ImageViewTouch for Android

Badge

Build Status Download

ImageViewTouch is an android ImageView widget with zoom and pan capabilities. This is an implementation of the ImageView widget used in the Gallery app of the Android opensource project.

Checkout the repository and run the ImageViewTouchTest project to see how it works. Beside the superclass setImageBitmap method it offers the following methods:

  • setImageBitmap( final Bitmap bitmap, Matrix matrix );
  • setImageBitmap( final Bitmap bitmap, Matrix matrix, float minZoom, float maxZoom );

If you want to load a new Bitmap with a particular zoom/pan state (let's say the same from another ImageView ), you can call:

Matrix matrix = mImageView1.getDisplayMatrix();
mImageView2.setImageBitmap( bitmap, matrix );

Tweaks

The initial display state can be set, using public void setDisplayType( DisplayType type ), as:

  • DisplayType.FIT_TO_SCREEN: The image loaded will always fit the current view's bounds.
  • DisplayType.NONE: The image will be presented with its current dimensions if smaller than the image bounds, otherwise it will be scaled to fit its contents inside the screen.
  • DisplayType.FIT_HEIGHT: The image loaded will always fit the height of the current view.
  • DisplayType.FIT_WIDTH: The image loaded will always fit the width of the current view.

The default display state is `DisplayState.NONE'.

##Usage (Maven) it.sephiroth.android.library.imagezoom imagezoom 2.3.0

##Usage (Gradle)

dependencies {
	compile 'it.sephiroth.android.library.imagezoom:imagezoom:+'
}

##LICENSE

This software is provided under the MIT license:
http://opensource.org/licenses/mit-license.php

##Author

Alessandro Crugnola

Comments
  • Errors to import project in Eclipse

    Errors to import project in Eclipse

    When I import the project in Eclipse I am getting errors in the class library/ImageViewTouchBase

    import it.sephiroth.android.library.easing.Cubic; --> cannot be resolved import it.sephiroth.android.library.easing.Easing; --> cannot be resolved

    What am I doing wrong?

    opened by christian160984 7
  • canScroll method added

    canScroll method added

    I've added a canScroll method to an ImageViewTouch. It helps very much when ImageViewTouch is used inside a ViewPager. In this case you have to use custom ViewPager, like this: https://gist.github.com/3781644.

    Params of a method are described in javadoc

    opened by atermenji 6
  • add *FIT_HEIGHT* and *FIT_WIDTH* DisplayTypes

    add *FIT_HEIGHT* and *FIT_WIDTH* DisplayTypes

    We are using this library in our production code and we need the below DisplayTypes. And we believe that adding this functionality will surely add value to an already amazing library.

    FIT_HEIGHT : The image fits such that the Image height matches the device height. Generally useful in portrait orientation. FIT_WIDTH : The image fits such that the Image width matches the device width. Generally useful in landscape orientation.

    P.S. : We have also updated the gradle files and have made sure that the builds pass on Travis.

    opened by sumit-anantwar 4
  • MIN SDK

    MIN SDK

    Hi,

    what is the latest version that was working with min SDK 15? I used the gradle dependency "...:+" for a while now but this morning the min SDK was upgraded to 16.

    Thank you, Patric

    opened by paatz04 3
  • SingleTap event listener added

    SingleTap event listener added

    I've added a onSingleTapConfirmed() callback. It was useful because I wanted to hide/show actionbar on single tap like it is done in default Android Gallery app on Galaxy Nexus. onSingleTapConfirmed() callback prevents the user of a lib from receiving DoulbeTap events when they only need to catch a single tap. Docs on this method are here: http://developer.android.com/reference/android/view/GestureDetector.SimpleOnGestureListener.html#onSingleTapConfirmed(android.view.MotionEvent)

    opened by atermenji 3
  • minSDK version changed to 16?

    minSDK version changed to 16?

    My application's minSDK version is 15. Your library was working perfectly until yesterday. After last commit I cannot build my application because of the minSDK issue.

    At Your library's manifest file it says minSdkVersion="9" but your gradle, it says minSdkVersion="16".

    Please fix this. I cannot use minSdkVersion="16" in my app. If you not, I will use another library.

    opened by oguzhandongul 2
  • Setting a bitmap after downloading it using an AsyncTask

    Setting a bitmap after downloading it using an AsyncTask

    Sephiroth:

    I am running to an issue you might know how to fix it.

    A sample code that reproduces the issue is hosted here: https://github.com/Macarse/ImageViewZoom/tree/ImageViewTouchDownloadBug

    I am downloading a Bitmap using an AsyncTask, but when I set it, the ImageView isn't resized according to the scaleType. If I run the sample I created in a Nexus 10 tablet, it looks like this:

    screen1

    where I would like it to look like this:

    screen2

    Any idea of how to solve this issue?

    opened by Macarse 2
  • Use getScaledTouchSlop() instead of getTouchSlop()

    Use getScaledTouchSlop() instead of getTouchSlop()

    getTouchSlop() is deprecated, but is not posible to use getScaledTouchSlop, returns this error:

    Cannot make a static reference to the non-static method getScaledTouchSlop() from the type ViewConfiguration.

    opened by antoni-alvarez 2
  • Image initial jumping

    Image initial jumping

    I'm trying to implement this library with glide and used as a shared element. But the problem is that there is an initial jump: the image is first shown at the top of the screen then jumps to the center.

    opened by elod91 1
  • Animated GIFs

    Animated GIFs

    This is a feature request to support animated gif images. (Maybe also APNGs?)

    May look into forking and adding myself. Not even sure if the project is still maintained.

    opened by navarr 1
  • Disable PagerAdapter swipe when ImageViewTouch is zoomed

    Disable PagerAdapter swipe when ImageViewTouch is zoomed

    Hi,

    I wonder how I can make the ImageViewTouch to scroll in x-axis when in zoom mode only, otherwise the PagerAdapter should be called so pages are changed instead.

    I've also asked on Stack Overflow: http://stackoverflow.com/questions/19562312/disable-swipe-in-pageradapter-if-imageviewtouch-is-in-zoom-mode

    Thanks in advance. :)

    Best regards, Henric

    opened by NinjaRat84 1
  • Openharmony  application

    Openharmony application

    I am developing an Openharmony application with JavaScript langue which used your library,will your library support Openharmony platform by JavaScript language? If so,I want to contribute to the Openharmony build of this library. Expecte for your repley!

    opened by chenguangweixi 0
  • How to get coordinates (pixels area) of points in an image

    How to get coordinates (pixels area) of points in an image

    How to get coordinates of points in an image.

    imageViewTouch.setSingleTapListener(new ImageViewTouch.OnImageViewTouchSingleTapListener() { @Override public void onSingleTapConfirmed() { x = String.valueOf(imageViewTouch.getY()); y = String.valueOf(imageViewTouch.getX()); } });

    Unfortunately, this is not correct. In which direction should we move towards the right solution?

    opened by g-n-p 0
  • How To Lock ImageView (enable / disable zoom and panning function in imageview)

    How To Lock ImageView (enable / disable zoom and panning function in imageview)

    I am Not Able To Lock ImageView On Button Click.

    I Want To Lock ImageView When I Click On Button And Also Unlock It When I Click Same Button Again.

    In Project I Place Or Zoom My Image As Per My Requirement And Set Locked So Image Stay In That Position Until I Click Again on Lock Button.

    opened by rahul107 0
  • This view intercepts all touch events

    This view intercepts all touch events

    I am using the image view with MATCH_PARENT width and height. I also have floating buttons on top of the image. The buttons box auto-hides and works with gestures. The problem is even if I override the activity's onTouchEvent the image will always intercept all touch events and doesn't dispatch to other listeners. so I had to set the images touch listener to detect the gesture and the passed view's touch event as a workaround

    opened by wisammechano 1
  • not able to save image using this imageview why?

    not able to save image using this imageview why?

    instead of this imageview normal imageview can save image but in this imageview main image dissapears how to show image of current imageview (it.sephiroth.android.library.imagezoom.ImageViewTouch) in another activity by sending using intent ?

    opened by rahul107 0
Owner
Alessandro Crugnola
Alessandro Crugnola
Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling Scale Image View, Fresco, Glide, and Picasso. Even with gif and webp support! 🍻

BigImageViewer Big image viewer supporting pan and zoom, with very little memory usage and full featured image loading choices. Powered by Subsampling

Piasy 3.9k Dec 30, 2022
An open source Android library that allows the visualization of large images with gesture capabilities

ByakuGallery ByakuGallery is an open source Android library that allows the visualization of large images with gesture capabilities. This lib is based

Diego Lima 311 Dec 4, 2022
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon

This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate

Stfalcon LLC 1.8k Dec 19, 2022
Slider-Gallery-Zoom: image slider for android supporting indicator and auto scroll with clicking on image

image slider supporting indicator and auto scroll with clicking on image to open full screen image slider swipe and pinch zoom gestures like gallery,just pass your images and the position of the current image.

Mahmoud Elian 3 May 28, 2022
Android library (AAR). Highly configurable, easily extendable deep zoom view for displaying huge images without loss of detail. Perfect for photo galleries, maps, building plans etc.

Subsampling Scale Image View A custom image view for Android, designed for photo galleries and displaying huge images (e.g. maps and building plans) w

null 7.4k Jan 8, 2023
Tutorial Double Tap Pinch to Zoom with kotlin

Double-Tap-Pinch-Zoom Tutorial Double Tap Pinch to Zoom Tutorial Build with Andr

Azhar Rivaldi 6 Apr 13, 2022
PinchToZoom - Pinch to zoom used within list like Instagram

Pinch To Zoom ?? Description Pinch to Zoom with Pan Gestures like Instagram ?? Motivation and Context Big Thanks ???? to the guy and his amazing repo

Vivek Sharma 12 Apr 12, 2022
ImageView and FrameLayout with gestures control and position animation

GestureViews ImageView and FrameLayout with gestures control and position animation. Main goal of this library is to make images viewing process as sm

Alex Vasilkov 2.3k Dec 30, 2022
Create parallax and any other transformation effects on scrolling android ImageView

Android Parallax Image View Creates effect such as vertical parallax, horizontal parallax etc. on android ImageView when it's being vertically or hori

Aris 164 Dec 7, 2022
Crop and Rounded Corners added to an ImageView.

SuperImageView Extra features for your ImageView provided in a modularized way Documentation for v2 coming this week. CropImageView An ImageView that

César Díez Sánchez 657 Jan 5, 2023
Subclass of ImageView that 'morphs' into a circle shape and can rotates. Useful to be used as album cover in Music apps. :dvd::notes:

Music Cover View A Subclass of ImageView that 'morphs' into a circle shape and can rotates. Useful to be used as album cover in Music apps. It's used

André Mion 254 Dec 23, 2022
Crop and Rounded Corners added to an ImageView.

SuperImageView Extra features for your ImageView provided in a modularized way Documentation for v2 coming this week. CropImageView An ImageView that

César Díez Sánchez 658 Dec 1, 2022
Custom ImageView for android with polygon shape (Android)

PolygonImageView Create a custom ImageView with polygonal forms. Usage To use PolygonImageView, add the module into your project and start to build xm

Albert Grobas 531 Dec 25, 2022
Implementation of ImageView for Android that supports zooming, by various touch gestures.

PhotoView PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView. [ Dependency Add this in your root build.grad

Baseflow 18.4k Dec 30, 2022
A circular ImageView for Android

CircleImageView A fast circular ImageView perfect for profile images. This is based on RoundedImageView from Vince Mi which itself is based on techniq

Henning Dodenhof 13.8k Mar 29, 2021
Adds touch functionality to Android ImageView.

TouchImageView for Android Capabilities TouchImageView extends ImageView and supports all of ImageView’s functionality. In addition, TouchImageView ad

Michael Ortiz 2.4k Mar 28, 2021
Custom shaped android imageview components

Shape Image View Provides a set of custom shaped android imageview components, and a framework to define more shapes. Implements both shader and bitma

Siyamed SINIR 2.6k Mar 29, 2021
Android ImageView replacement which allows image loading from URLs or contact address book, with caching

Smart Image View for Android SmartImageView is a drop-in replacement for Android’s standard ImageView which additionally allows images to be loaded fr

James Smith 1.3k Dec 24, 2022