get TextView Center X - Android User Interface

Android examples for User Interface:TextView

Description

get TextView Center X

Demo Code


//package com.java2s;

import android.widget.TextView;

public class Main {
    public static float getTextViewCenterX(TextView textView) {
        float x = (textView.getLeft() + textView.getRight()) / 2;
        return x;
    }/*from   w w w. j  a  va  2 s  .c o m*/
}

Related Tutorials