List of usage examples for android.widget RelativeLayout getLocationInWindow
public void getLocationInWindow(@Size(2) int[] outLocation)
Computes the coordinates of this view in its window.
From source file:Main.java
public static boolean isPointInsideOption(Point balloonLocation, RelativeLayout optionLayout) { int[] optionLocation = new int[2]; optionLayout.getLocationInWindow(optionLocation); int x = balloonLocation.x; int y = balloonLocation.y; int oX = optionLocation[0]; int oY = optionLocation[1]; if (y >= oY && y <= oY + optionLayout.getHeight() && x >= oX && x <= oX + optionLayout.getWidth()) { return true; } else//from w w w . j a v a 2s. c om return false; }