Java tutorial
//package com.java2s; import android.graphics.Rect; import android.view.View; public class Main { public static Rect getRectInScreen(View view) { Rect rect = new Rect(); int[] loc = new int[2]; view.getLocationOnScreen(loc); rect.left = loc[0]; rect.top = loc[1]; rect.right = loc[0] + view.getWidth(); rect.bottom = loc[1] + view.getHeight(); return rect; } }