Android examples for User Interface:View Property
get View Relative Top
//package com.java2s; import android.view.View; public class Main { private static int getRelativeTop(View myView) { if (myView.getParent() == myView.getRootView()) return myView.getTop(); else/*from w w w .j a va2 s . c o m*/ return myView.getTop() + getRelativeTop((View) myView.getParent()); } }