ImageView no longer exists. You should not use this PhotoViewAttacher any more
生活随笔
收集整理的這篇文章主要介紹了
ImageView no longer exists. You should not use this PhotoViewAttacher any more
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
參考GitHub的解決方法
把PhotoviewAttacher 類中的cleanup()方法替代成下面的方法
@SuppressLint("NewApi")@SuppressWarnings("deprecation")public final void cleanup() {if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN){if (null != mImageView) {mImageView.get().getViewTreeObserver().removeOnGlobalLayoutListener(this);}if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {mViewTreeObserver.removeOnGlobalLayoutListener(this);mViewTreeObserver = null;// Clear listeners toomMatrixChangeListener = null;mPhotoTapListener = null;mViewTapListener = null;// Finally, clear ImageViewmImageView = null;}}else{if (null != mImageView) {mImageView.get().getViewTreeObserver().removeGlobalOnLayoutListener(this);}if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {mViewTreeObserver.removeGlobalOnLayoutListener(this);mViewTreeObserver = null;// Clear listeners toomMatrixChangeListener = null;mPhotoTapListener = null;mViewTapListener = null;// Finally, clear ImageViewmImageView = null;}}}總結
以上是生活随笔為你收集整理的ImageView no longer exists. You should not use this PhotoViewAttacher any more的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Java基础:String类
- 下一篇: java.lang.IllegalArg