支持.FinishAfterTransition()时ScaleType崩溃

时间:2015-08-13 07:39:23

标签: android imageview android-support-library android-appcompat scaletype

当我使用supportFinishAfterTransition();缩小转场时,我遇到了崩溃。我已经挣扎了近2个小时而没有解决任何问题。非常感谢帮助!你有什么线索吗?

提前致谢!

08-13 09:31:43.375    2490-3109/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.adeya.android, PID: 2490
    java.lang.IllegalStateException: The ImageView's ScaleType has been changed since attaching a PhotoViewAttacher
            at uk.co.senab.photoview.PhotoViewAttacher.checkImageViewScaleType(PhotoViewAttacher.java:707)
            at uk.co.senab.photoview.PhotoViewAttacher.setImageViewMatrix(PhotoViewAttacher.java:821)
            at uk.co.senab.photoview.PhotoViewAttacher.resetMatrix(PhotoViewAttacher.java:813)
            at uk.co.senab.photoview.PhotoViewAttacher.updateBaseMatrix(PhotoViewAttacher.java:898)
            at uk.co.senab.photoview.PhotoViewAttacher.onGlobalLayout(PhotoViewAttacher.java:426)
            at android.view.ViewTreeObserver.dispatchOnGlobalLayout(ViewTreeObserver.java:863)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2059)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1180)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6558)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
            at android.view.Choreographer.doCallbacks(Choreographer.java:590)
            at android.view.Choreographer.doFrame(Choreographer.java:560)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
            at android.os.Handler.handleCallback(Handler.java:739)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:145)
            at android.app.ActivityThread.main(ActivityThread.java:5832)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

1 个答案:

答案 0 :(得分:1)

已经很久了,但是有人仍然面临这个问题: 在完成活动之前,您应该调用cleanUp():

@Override
public void onDestroy() {
    super.onDestroy();

    mAttacher.cleanup();
}