Java tutorial
//package com.java2s; import android.graphics.Rect; import android.view.View; public class Main { static Rect getViewAbsRect(View view, int parentX, int parentY) { int[] loc = new int[2]; view.getLocationInWindow(loc); Rect rect = new Rect(); rect.set(loc[0], loc[1], loc[0] + view.getMeasuredWidth(), loc[1] + view.getMeasuredHeight()); rect.offset(-parentX, -parentY); return rect; } }