Get View relative Center X - Android User Interface

Android examples for User Interface:View Center

Description

Get View relative Center X

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static float relativeCenterX(View view) {
        return (view.getLeft() + view.getRight()) / 2f;
    }/*from  w  ww. j  a v a 2 s .  co m*/
}

Related Tutorials