get View Center X - Android User Interface

Android examples for User Interface:View Center

Description

get View Center X

Demo Code


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

public class Main {
    public static float getCenterX(View view) {
        if (view != null) {
            return view.getX() + view.getWidth() / 2.0f;
        }//from   w  w w  .  j  a va2 s.co  m
        return 0;
    }
}

Related Tutorials