zoukankan      html  css  js  c++  java
  • java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.

     java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.

    这个错误今天碰到了,下面是解决方法,直接上代码

    PhotoViewAttacher  文件中 更改cleanup方法
     
    发现可行
     1     /* 
     2          * @SuppressWarnings("deprecation")  
     3          * public final void cleanup() {  
     4          *      if (null!= mImageView) { 
     5          *          mImageView.get().getViewTreeObserver().removeGlobalOnLayoutListener(this);  
     6          *      }  
     7          *      mViewTreeObserver = null; 
     8          *  
     9          * // Clear  
    10          *      listeners too mMatrixChangeListener = null;  
    11          *      mPhotoTapListener = null; 
    12          *      mViewTapListener = null; 
    13          *  
    14          * // Finally, clear ImageView  
    15          *      mImageView = null; } 
    16          */  
    17         @SuppressWarnings("deprecation")  
    18         public final void cleanup() {  
    19             if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {  
    20                 if (null != mImageView) {  
    21                     mImageView.get().getViewTreeObserver()  
    22                             .removeOnGlobalLayoutListener(this);  
    23                 }  
    24       
    25                 if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {  
    26                     mViewTreeObserver.removeOnGlobalLayoutListener(this);  
    27       
    28                     mViewTreeObserver = null;  
    29       
    30                     // Clear listeners too  
    31                     mMatrixChangeListener = null;  
    32                     mPhotoTapListener = null;  
    33                     mViewTapListener = null;  
    34                     // Finally, clear ImageView  
    35                     mImageView = null;  
    36                 }  
    37       
    38             } else {  
    39                 if (null != mImageView) {  
    40                     mImageView.get().getViewTreeObserver()  
    41                             .removeGlobalOnLayoutListener(this);  
    42                 }  
    43       
    44                 if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {  
    45                     mViewTreeObserver.removeGlobalOnLayoutListener(this);  
    46       
    47                     mViewTreeObserver = null;  
    48       
    49                     // Clear listeners too  
    50                     mMatrixChangeListener = null;  
    51                     mPhotoTapListener = null;  
    52                     mViewTapListener = null;  
    53                     // Finally, clear ImageView  
    54                     mImageView = null;  
    55                 }  
    56             }  
    57         }  
  • 相关阅读:
    IE6 跟随滚动解决方法
    CentOS 7 用户怎样安装 LNMP(Nginx+PHP+MySQL)
    [ConcurrencyCheck]并发检查
    centos7下修改docker工作目录
    kubernetes 1.14安装部署helm插件
    kubernetes 1.14安装部署EFK日志收集系统
    kubernetes 1.14安装部署dashboard
    kubernetes 1.14安装部署metrics-server插件
    calico客户端工具calicoctl
    centos7使用kubeadm安装部署kubernetes 1.14
  • 原文地址:https://www.cnblogs.com/wangying222/p/6007989.html
Copyright © 2011-2022 走看看