先看官方说明:
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本身而不对祖先的可见性进行判断。
时间: 2024-10-19 19:17:29