make Rect - Android Graphics

Android examples for Graphics:Rectangle

Description

make Rect

Demo Code


//package com.java2s;
import android.graphics.Rect;

public class Main {
    public static Rect makeRect(int x, int y, int w, int h) {
        return new Rect(x, y, x + w, y + h);
    }/*from   www .j ava  2 s  .  c  o  m*/

    public static Rect makeRect(float x, float y, float w, float h) {
        return new Rect((int) x, (int) y, (int) (w + 0.5f),
                (int) (h + 0.5f));
    }
}

Related Tutorials