Get View bounding Rect - Android User Interface

Android examples for User Interface:View Property

Description

Get View bounding Rect

Demo Code


//package com.java2s;

import android.graphics.Rect;

public class Main {
    public static Rect boundingRect(float centerX, float centerY,
            float radius) {
        Rect rect = new Rect();
        rect.left = Math.round(centerX - radius);
        rect.right = Math.round(centerX + radius);
        rect.top = Math.round(centerY - radius);
        rect.bottom = Math.round(centerY + radius);
        return rect;
    }/*from   w  w w .jav a 2  s . c om*/
}

Related Tutorials