【极简】android 检测一个控件是否可见【非visibility检测】

/** * 检测制定View是否被遮住显示不全 * @return*/
 protected boolean isCover(View view) {
    boolean cover = false;        
    Rect rect = new Rect();
    cover = view.getGlobalVisibleRect(rect);
         if (cover) {  
                 if (rect.width() >= view.getMeasuredWidth() && rect.height() >= view.getMeasuredHeight()) {
                     return !cover;
                }
        }
        return true;
    }


你可能感兴趣的:(【极简】android 检测一个控件是否可见【非visibility检测】)