is View Covered - Android User Interface

Android examples for User Interface:View

Description

is View Covered

Demo Code


//package com.java2s;
import android.app.Activity;
import android.graphics.Rect;
import android.view.View;

import android.view.Window;

public class Main {
    public static boolean isViewCovered(final View view, Activity bReader) {
        if (bReader == null)
            return true;
        Rect screenRec = new Rect();
        Rect viewRect = new Rect();
        View v = bReader.getWindow()
                .findViewById(Window.ID_ANDROID_CONTENT);
        v.getGlobalVisibleRect(screenRec);
        view.getGlobalVisibleRect(viewRect);
        if (screenRec.contains(viewRect))
            return false;
        else//from  w  ww  .  jav  a  2  s  .  c  o m
            return true;
    }
}

Related Tutorials