Android examples for User Interface:Layout
get View Layout X
//package com.java2s; import android.graphics.Rect; import android.view.View; public class Main { public static int getLayoutX(View view) { int[] location = new int[2]; Rect rect = new Rect(); view.getLocalVisibleRect(rect);/*from www .j a v a2 s .c o m*/ view.getLocationInWindow(location); view.getLocationOnScreen(location); return location[0]; } }