Get View relative Center Y - Android User Interface

Android examples for User Interface:View Center

Description

Get View relative Center Y

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static float relativeCenterY(View view) {
        return (view.getTop() + view.getBottom()) / 2f;
    }//  ww  w.  ja v a  2  s .  c om
}

Related Tutorials