get View Center - Android User Interface

Android examples for User Interface:View

Description

get View Center

Demo Code


//package com.java2s;
import android.graphics.Point;
import android.view.View;

public class Main {
    public static Point getViewCenter(View view) {
        Point ret = new Point(view.getTop() + view.getHeight() / 2,
                view.getLeft() + view.getWidth() / 2);
        return ret;
    }/*ww w .  j  a  va2s. c om*/
}

Related Tutorials