Android examples for Graphics:Rectangle
get Rect Center Y
//package com.java2s; import android.graphics.Rect; import android.graphics.RectF; public class Main { public static int getCenterY(Rect rect) { return Math.round(rect.top + (rect.bottom - rect.top) / 2); }//from w ww .j a v a 2s .co m public static float getCenterY(RectF rect) { return (rect.top + (rect.bottom - rect.top) / 2); } }