如何在ImageView VisibiltyChanged上收听

时间:2016-06-08 21:48:30

标签: android android-imageview

我试图在setVisibility功能完成它的工作后做某事,无论如何我能做到吗?因为OnSystemUiVisibilityChangeListener不是我需要的,我找不到允许我这样做的任何方法!

2 个答案:

答案 0 :(得分:0)

如下所示:

ViewTreeObserver.html#addOnGlobalLayoutListener

  

注册要在全局布局状态或时调用的回调   视图树中视图的可见性发生变化

因此,您可以将addOnGlobalLayoutListener添加到ImageView,例如:

imageView.setTag(imageView.getVisibility());
....
@Override
    public void onGlobalLayout() {
        int visibility = imageView.getVisibility();
        if(Integer.parseInt(imageView.getTag()) != visibility)
        {
            // visibility changes...
        }
    }
 ....

答案 1 :(得分:0)

你可以试试这个,它会在每次布局改变时被触发

elasticdump \
  --input=http://localhost:9200/prod-index \
  --output=http://localhost:9200/local-index \
  --type=data \
  --ignore-errors \
  --maxSockets=5

But it only dumped the first 100 objects and then gave error like
Wed, 08 Jun 2016 22:35:30 GMT | starting dump
Wed, 08 Jun 2016 22:35:30 GMT | got 100 objects from source elasticsearch (offset: 0)
Wed, 08 Jun 2016 22:35:30 GMT | sent 100 objects to destination file, wrote 100
Wed, 08 Jun 2016 22:35:31 GMT | Error Emitted => <html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Wed, 08 Jun 2016 22:35:31 GMT | got 0 objects from source elasticsearch (offset: 100)
Wed, 08 Jun 2016 22:35:31 GMT | Total Writes: 100
Wed, 08 Jun 2016 22:35:31 GMT | dump complete