Implementation of ImageView for Android that supports zooming, by various touch gestures.

Related tags

PhotoView
Overview

PhotoView

PhotoView aims to help produce an easily usable implementation of a zooming Android ImageView.

[

Dependency

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        maven { url "https://www.jitpack.io" }
    }
}

buildscript {
    repositories {
        maven { url "https://www.jitpack.io" }
    }	
}

Then, add the library to your module build.gradle

dependencies {
    implementation 'com.github.chrisbanes:PhotoView:latest.release.here'
}

Features

  • Out of the box zooming, using multi-touch and double-tap.
  • Scrolling, with smooth scrolling fling.
  • Works perfectly when used in a scrolling parent (such as ViewPager).
  • Allows the application to be notified when the displayed Matrix has changed. Useful for when you need to update your UI based on the current zoom/scroll position.
  • Allows the application to be notified when the user taps on the Photo.

Usage

There is a sample provided which shows how to use the library in a more advanced way, but for completeness, here is all that is required to get PhotoView working:

<com.github.chrisbanes.photoview.PhotoView
    android:id="@+id/photo_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
PhotoView photoView = (PhotoView) findViewById(R.id.photo_view);
photoView.setImageResource(R.drawable.image);

That's it!

Issues With ViewGroups

There are some ViewGroups (ones that utilize onInterceptTouchEvent) that throw exceptions when a PhotoView is placed within them, most notably ViewPager and DrawerLayout. This is a framework issue that has not been resolved. In order to prevent this exception (which typically occurs when you zoom out), take a look at HackyDrawerLayout and you can see the solution is to simply catch the exception. Any ViewGroup which uses onInterceptTouchEvent will also need to be extended and exceptions caught. Use the HackyDrawerLayout as a template of how to do so. The basic implementation is:

public class HackyProblematicViewGroup extends ProblematicViewGroup {

    public HackyProblematicViewGroup(Context context) {
        super(context);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        try {
            return super.onInterceptTouchEvent(ev);
        } catch (IllegalArgumentException e) {
						//uncomment if you really want to see these errors
            //e.printStackTrace();
            return false;
        }
    }
}

Usage with Fresco

Due to the complex nature of Fresco, this library does not currently support Fresco. See this project as an alternative solution.

Subsampling Support

This library aims to keep the zooming implementation simple. If you are looking for an implementation that supports subsampling, check out this project

License

Copyright 2018 Chris Banes

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Issues
  • IllegalArgumentException (pointerIndex out of range) while using many fingers to zoom in and out

    IllegalArgumentException (pointerIndex out of range) while using many fingers to zoom in and out

    (Android 4.2.1 - Samsung Galaxy Nexus)

    java.lang.IllegalArgumentException: pointerIndex out of range at android.view.MotionEvent.nativeGetAxisValue(Native Method) at android.view.MotionEvent.getX(MotionEvent.java:1981) at android.support.v4.view.MotionEventCompatEclair.getX(MotionEventCompatEclair.java:32) at android.support.v4.view.MotionEventCompat$EclairMotionEventVersionImpl.getX(MotionEventCompat.java:86) at android.support.v4.view.MotionEventCompat.getX(MotionEventCompat.java:184) at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:1339) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1817) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1405) at android.app.Activity.dispatchTouchEvent(Activity.java:2410) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1901) at android.view.View.dispatchPointerEvent(View.java:7419) at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3220) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3165) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4292) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4271) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4363) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:179) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:171) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:4342) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:4382) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) at android.view.Choreographer.doCallbacks(Choreographer.java:562) at android.view.Choreographer.doFrame(Choreographer.java:530) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5191) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) at dalvik.system.NativeStart.main(Native Method)

    bug duplicate 
    opened by adrien-aubel 34
  •  java.lang.ArrayIndexOutOfBoundsException: length=1; index=1

    java.lang.ArrayIndexOutOfBoundsException: length=1; index=1

    hi,

    I try to use your library but i have the exception bellow when zoom in.

    08-30 22:44:43.437  20210-20210/com.******E/AndroidRuntime: FATAL EXCEPTION: main
            java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
            at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1004)
            at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:855)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1852)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952)
            at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2209)
            at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1952)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1966)
            at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1418)
            at android.app.Activity.dispatchTouchEvent(Activity.java:2424)
            at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchTouchEvent(ActionBarActivityDelegateICS.java:255)
            at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1914)
            at android.view.View.dispatchPointerEvent(View.java:7564)
            at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3883)
            at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
            at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
            at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
            at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
            at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
            at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
            at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
            at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
            at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
            at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
            at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
            at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
            at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
            at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5493)
            at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
            at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
            at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:174)
            at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5472)
            at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5512)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
            at android.view.Choreographer.doCallbacks(Choreographer.java:562)
            at android.view.Choreographer.doFrame(Choreographer.java:530)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5103)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
    
    bug 
    opened by Michenux 30
  • ImageView no longer exists. problem

    ImageView no longer exists. problem

    fix  ImageView no longer exists. You should not use this PhotoViewAttacher any more. the cleanup don't work so i fixed it like this.

    opened by xeodou 22
  • ViewPager memory issues and dev branch sample not working

    ViewPager memory issues and dev branch sample not working

    I was having the memory leak issues using a ViewPager, so I switched over to the dev branch to try out those changes. However, after trying for a while to get it to work, it never seemed to register to be able to zoom and tap the photo. So I decided to try the sample app from this repo (on the dev branch). That app wasn't working for me either.

    Could someone else please verify that I'm not crazy or missing something?

    In the meantime, I've gone back to the master branch and just implemented the cleanup function in the attacher myself for now.

    opened by kutothe 21
  • Crash

    Crash

    When i zoom out the image i'm facing this crash.

    java.lang.ArrayIndexOutOfBoundsException: length=1; index=1 at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:849) at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1057) at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1434) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2059) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2430) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2172) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2376) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1727) at android.app.Activity.dispatchTouchEvent(Activity.java:2783) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2337) at android.view.View.dispatchPointerEvent(View.java:8585) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4074) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3940) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3485) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3538) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3504) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3512) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3485) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3538) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3504) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3614) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3512) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3671) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3485) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3538) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3504) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3512) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3485) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5759) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5733) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5704) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5878) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:5828) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:5901) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767) at android.view.Choreographer.doCallbacks(Choreographer.java:580) at android.view.Choreographer.doFrame(Choreographer.java:548) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753) at android.os.Handle

    opened by alcntml 20
  • java.lang.IllegalArgumentException: pointerIndex out of range

    java.lang.IllegalArgumentException: pointerIndex out of range

    java.lang.IllegalArgumentException: pointerIndex out of range

    bug 
    opened by Saklhc 17
  •  ImageView no longer exists. You should not use this PhotoViewAttacher any more.

    ImageView no longer exists. You should not use this PhotoViewAttacher any more.

    05-02 17:21:59.583: E/AndroidRuntime(6325): FATAL EXCEPTION: main 05-02 17:21:59.583: E/AndroidRuntime(6325): java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more. 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoViewAttacher.getImageView(PhotoViewAttacher.java:210) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoViewAttacher.update(PhotoViewAttacher.java:482) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.view.photoview.PhotoView.setImageDrawable(PhotoView.java:114) 05-02 17:21:59.583: E/AndroidRuntime(6325): at android.widget.ImageView.setImageBitmap(ImageView.java:377) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.yijian.app.activity.GalleryActivity$TestAdapter$1.onLoadingComplete(GalleryActivity.java:287) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.nostra13.universalimageloader.core.DisplayBitmapTask.run(DisplayBitmapTask.java:64) 05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Handler.handleCallback(Handler.java:605) 05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Handler.dispatchMessage(Handler.java:92) 05-02 17:21:59.583: E/AndroidRuntime(6325): at android.os.Looper.loop(Looper.java:137) 05-02 17:21:59.583: E/AndroidRuntime(6325): at android.app.ActivityThread.main(ActivityThread.java:4424) 05-02 17:21:59.583: E/AndroidRuntime(6325): at java.lang.reflect.Method.invokeNative(Native Method) 05-02 17:21:59.583: E/AndroidRuntime(6325): at java.lang.reflect.Method.invoke(Method.java:511) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787) 05-02 17:21:59.583: E/AndroidRuntime(6325): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554) 05-02 17:21:59.583: E/AndroidRuntime(6325): at dalvik.system.NativeStart.main(Native Method)

    opened by fanei 17
  • Cannot move around a zoomed image in 1.2.2 when it is placed inside ViewPager

    Cannot move around a zoomed image in 1.2.2 when it is placed inside ViewPager

    In the latest version 1.2.2 the PhotoView behavior when it is placed inside a ViewPager is different from 1.2.1. In the previous version you can easily perform an image zoom and move around the image. In this new version, it is hard to move to the image bounds as the ViewPager is intercepting touch events and tries to switch page instead of moving inside zoomed image.

    bug 
    opened by alvarolb 15
  • ImageView inside ViewPager ignores layout params

    ImageView inside ViewPager ignores layout params

    I have an ImageView in a fragment hosted by a view pager. The fragment layout is a RelativeLayout and the ImageView is centerPositioned inside of it. When I initialize the PhotoAttacher with the ImageView the image starts at the top of the screen instead of in the center of the screen. If I touch and drag a tiny bit in any direction the image immediately snaps into place. The image is loaded dynamically from the web if that is useful.

    bug 
    opened by pfives 15
  • the imgview is not int the center, when i use the PhotoViewAttacher

    the imgview is not int the center, when i use the PhotoViewAttacher

    the imgview is not int the center, when i use the PhotoViewAttacher. The photo is always at the top ,but when i touch the photo , the photo move to the center.Please help me .

    opened by AnswerZhao 14
  • How to zoom the image for the given coordinates

    How to zoom the image for the given coordinates

    How to zoom the image for the given coordinates Rect(left, top, right, bottom)

    opened by kpradeepkumarreddy 1
  • ViewPager nested photoView sliding conflict

    ViewPager nested photoView sliding conflict

    🐛 Bug Report

    Expected behavior

    Hello, there is an error in the Matrix boundary processing, which leads to a sliding conflict

    Reproduction steps

    Configuration

    image

    Version: 2.0

    Platform: :robot: Android 9.x

    opened by chuxuecentaline 0
  • Added the option to enable/disable zoom to min on pinch release and double tap functionality

    Added the option to enable/disable zoom to min on pinch release and double tap functionality

    :sparkles: What kind of change does this PR introduce? (Bug fix, feature, docs update...)

    feature

    :arrow_heading_down: What is the current behavior?

    :new: What is the new behavior (if this is a feature change)?

    *added option to enable/disable double tap functionality on images *add option to enable/disable zoom to minimum scale on pinch release (was necessary to my project)

    :boom: Does this PR introduce a breaking change?

    no

    :bug: Recommendations for testing

    :memo: Links to relevant issues/docs

    :thinking: Checklist before submitting

    • [ ] All projects build
    • [ ] Follows style guide lines
    • [ ] Relevant documentation was updated
    • [ ] Rebased onto current develop
    opened by taw96 0
  • java.lang.IllegalArgumentException: pointerIndex out of range

    java.lang.IllegalArgumentException: pointerIndex out of range

    🐛 Bug Report

    Expected behavior

    Reproduction steps

    Configuration

    Version: 1.x

    Platform: :robot: Android 9.x java.lang.IllegalArgumentException: pointerIndex out of range at android.view.MotionEvent.nativeGetAxisValue(Native Method) at android.view.MotionEvent.getX(MotionEvent.java:2371) at androidx.viewpager.widget.ViewPager.onInterceptTouchEvent(ViewPager.java:2072) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2657) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3124) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2803) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:570) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1963) at android.app.Activity.dispatchTouchEvent(Activity.java:4071) at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:523) at android.view.View.dispatchPointerEvent(View.java:13823) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5911) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5694) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5155) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5218) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5179) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5336) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5187) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5393) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5155) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5218) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5179) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5187) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5155) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7968) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:7937) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:7894) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:8112) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:206) at android.os.MessageQueue.nativePollOnce(Native Method) at android.os.MessageQueue.next(MessageQueue.java:340) at android.os.Looper.loop(Looper.java:183) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)

    opened by jiaoyongzhi 2
  • getPointerCount return 1 when I touch two fingers

    getPointerCount return 1 when I touch two fingers

    🐛 Bug Report

    I just use photoview in my project,and I find when I touch two fingers on the screen ,if the distance between fingers is not far ,then getPointerCount() will return 1 not 2.The distance maybe 3or 4 cm.

    Version: not clear(maybe the lastest)

    Platform: :robot: Android 9.0

    opened by Dempsey666-aiiy 0
  • 在viewpager中使用photoview展示长图 频繁进行缩放 大概率报java.lang.IllegalArgumentException: pointerIndex out of range

    在viewpager中使用photoview展示长图 频繁进行缩放 大概率报java.lang.IllegalArgumentException: pointerIndex out of range

    🐛 Bug Report

    Expected behavior

    Reproduction steps

    Configuration

    Version: 1.x

    Platform: :robot: Android 9.x

    opened by coder-xiaoshuai 0
  • hello,i feel this view setOnClickListener's callback is slowly

    hello,i feel this view setOnClickListener's callback is slowly

    💬 Questions and Help

    For questions or help we recommend checking:

    opened by zhaichuankai 1
  • How to keep the same zoom when changing the image with Glide

    How to keep the same zoom when changing the image with Glide

    💬 Questions and Help

    I am changing the image in PhotoView with Glide but every time the image is reset to the original size, I want to keep it in the same zoom since I am trying to do a comparison between 2 images?

    opened by JagarYousef 0
  • Zoomed Images Stays at Sub Layers

    Zoomed Images Stays at Sub Layers

    Hello, I love this zooming effect but I have a problem with it. I use multiple PhotoViews and TextViews at the same page and when I zoom a photo, its bounds seem limited and it zooms in its bounds. I know "android:adjustViewBounds="true"" cause this, but if I don't use it, the photos conflict and zoom areas get mixed.

    So I just want to zoom a PhotoView on uppest layer so it comes front withot conflict. How I can do that?

    Thanks.

    opened by Cingen 0
  • Show hint about which face is being identified on the

    Show hint about which face is being identified on the "People" page

    🚀 Feature Requests

    When opening a bunch of tabs to unidentified people for the purpose of individually merging them, it would help to show who's face is actually being watched.

    image

    Which one was I identifying again?

    Contextualize the feature

    The face icon can be on the top of the page, or the picture in the information panel on the right could have the face indicator circle for the currently viewed unidentified person marked with a different color or line style to distinguish from the rest.

    opened by Redsandro 0
Releases(2.0.0)
  • 2.0.0(Mar 18, 2017)

    • MinSDK bumped to 14
    • Listeners moved into their own classes outside of PhotoView
    • You should not need to have a reference to PhotoViewAttacher as most things can be called via the PhotoView itself.
    • PhotoView package change. Updated package will be com.github.chrisbanes.photoview.PhotoView
    Source code(tar.gz)
    Source code(zip)
  • 1.3.1(Oct 26, 2016)

    Update to the latest support library which allows for more granular dependencies. Requires an min SDK bump to 9. Sorry for those of you that were holding out!

    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Aug 2, 2016)

  • 1.2.7(Jul 26, 2016)

  • 1.2.6(Apr 15, 2016)

    Deprecate getOnPhotoTapListener and getOnViewTapListener. Change dependency to be available on jitpack instead of jcenter for easier/quicker releases

    Source code(tar.gz)
    Source code(zip)
Owner
Baseflow
We provide software, skills and knowledge and with this we want to make a contribution to the world. We love to make innovation happen.
Baseflow
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 6.9k Jul 27, 2021
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 17.8k Aug 5, 2021
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 17.8k Jul 26, 2021
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.2k Jul 28, 2021
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 Jul 19, 2021
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 650 Jun 30, 2021
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 650 Jun 30, 2021
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
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.8k Jul 25, 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
Play with bitmaps

BitmapMerger Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background thread

Harish Sridharan 455 Mar 17, 2021
Play with bitmaps

BitmapMerger Bitmap Merger is a simple project help you to merge two bitmaps without memory exceptions. The bitmaps are processed in background thread

Harish Sridharan 456 Jun 13, 2021
A photoView to scale image and finish activity,高仿微信可拖拽返回PhotoView

DragPhotoView(English) 高仿微信可拖拽返回PhotoView 基于 PhotoView ##下载APK体验 特性 拖拽缩放图片,并且结束Activity 其他PhotoView所有特性如下: Out of the box zooming, using multi-touch a

androidwing 1.6k Jul 24, 2021