I have a layout with a Spinner:
I would like to get the number of pixels from the top of the spinner to the bottom of the screen. Is there a way to achieve this?
To find the distance from top of the view, first find the distance of view from bottom and add the view height
DisplayMetrics dm = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
int[] loc = new int[2];
yourView.getLocationOnScreen(loc);
int distance = dm.heightPixels - loc[1];
Int viewHeight = yourView.getHeight()
distance +=viewHeight; //distance from top of the view