Here you can find the source of getTop(View myView)
public static int getTop(View myView)
//package com.java2s; import android.view.View; public class Main { public static int getTop(View myView) { if (myView.getParent() == myView.getRootView()) return myView.getTop(); else/* w ww . j a v a 2 s .c o m*/ return myView.getTop() + getTop((View) myView.getParent()); } }