get View Relative Left - Android User Interface

Android examples for User Interface:View Property

Description

get View Relative Left

Demo Code


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

public class Main {
    public static int getRelativeLeft(View myView) {
        if (myView.getParent() == myView.getRootView())
            return myView.getLeft();
        else/*from  w w w .ja  va2 s. com*/
            return myView.getLeft()
                    + getRelativeLeft((View) myView.getParent());
    }
}

Related Tutorials