Android get bounding rectangle of a View

Yes, View.getLocationOnScreen() did the trick. For example,

private boolean isViewContains(View view, int rx, int ry) {
    int[] l = new int[2];
    view.getLocationOnScreen(l);
    int x = l[0];
    int y = l[1];
    int w = view.getWidth();
    int h = view.getHeight();

    if (rx < x || rx > x + w || ry < y || ry > y + h) {
        return false;
    }
    return true;
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)