get View Layout Y - Android User Interface

Android examples for User Interface:Layout

Description

get View Layout Y

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    public static int getLayoutY(View view) {
        int[] location = new int[2];
        view.getLocationInWindow(location); 
        view.getLocationOnScreen(location);
        return location[1];
    }/*  w w  w  .ja va 2s.com*/
}

Related Tutorials