【android】view.isShown ()的用法

来源:互联网 发布:mac os 快速回到桌面 编辑:程序博客网 时间:2024/06/05 06:08


先看官方说明:

public boolean isShown ()

Added in API level 1

Returns the visibility of this view and all of its ancestors

Returns
  • True if this view and all of its ancestors are VISIBLE

也就是只有当view本身以及它的所有祖先们都是visible时,isShown()才返回TRUE。

而平常我们调用if(view.getVisibility() == View.VISIBLE)只是对view本身而不对祖先的可见性进行判断。

4 0