get View On Screen and return location - Android User Interface

Android examples for User Interface:View Position

Description

get View On Screen and return location

Demo Code


//package com.java2s;

import android.view.View;

public class Main {

    public static int[] getViewOnScreen(View view) {
        int[] location = new int[2];
        if (null != view) {
            view.getLocationOnScreen(location);
        }/*from w  w w . j  ava 2s.  c  o  m*/
        return location;
    }
}

Related Tutorials