Android examples for User Interface:View
calculate Delta between two View
//package com.java2s; import android.view.View; public class Main { public static int[] calculateDelta(View first, View second) { final int[] sourceLocation = new int[2]; first.getLocationOnScreen(sourceLocation); final int[] currentNameLocation = new int[2]; second.getLocationOnScreen(currentNameLocation); final int[] delta = new int[2]; delta[0] = currentNameLocation[0] - sourceLocation[0] + second.getPaddingLeft() - first.getPaddingLeft(); delta[1] = currentNameLocation[1] - sourceLocation[1] + second.getPaddingTop() - first.getPaddingTop(); return delta; }//from w w w. ja v a 2s. co m }