http://stackoverflow.com/questions/6796299/view-getvisibility-isshown-return-incorrect-visibility
在做某个帧动画的时候,当有数据的时候停止帧动画。
某次按下了home键,回到桌面,数据已经过来,但是View.isShown()返回了false。
getVisibility()
simply returns the visibility you want the view to have when added to the window. It doesn't change unless you call setVisibility()
. It also doesn't indicate whether the view is actually visible on screen.
isShown()
is similar. Here is the doc:
Returns the visibility of this view and all of its ancestors
Returns
True if this view and all of its ancestors areVISIBLE
使用如下方式解决:
if(textView.getVisibility == View.VISIBLE) {
// do something
}