Android examples for User Interface:View Position
get View Location
//package com.java2s; import android.graphics.Point; import android.support.annotation.NonNull; import android.view.View; public class Main { public static Point getViewLocation(@NonNull View view) { int[] location = new int[2]; view.getLocationOnScreen(location); int centerX = location[0]; int centerY = location[1]; return new Point(centerX, centerY); }//from w ww .j av a 2s.c o m }