Android examples for Graphics:Rectangle
get Rect Center X
//package com.java2s; import android.graphics.Rect; import android.graphics.RectF; public class Main { public static int getCenterX(Rect rect) { return Math.round(rect.left + (rect.right - rect.left) / 2); }/*from ww w . ja va2 s . c o m*/ public static float getCenterX(RectF rect) { return (rect.left + (rect.right - rect.left) / 2); } }