center View on Y axes - Android User Interface

Android examples for User Interface:View Center

Description

center View on Y axes

Demo Code


//package com.java2s;
import android.support.v4.view.ViewCompat;
import android.view.View;

public class Main {
    public static float centerY(View view) {
        return ViewCompat.getY(view) + view.getHeight() / 2f;
    }//  w  w w .j  a  va  2s .  c  om
}

Related Tutorials