点击获取元素位置,在 onclick 事件中这样写:
int[] viewLocation = new int[2];
view.getLocationInWindow(viewLocation);
int viewX = viewLocation[0]; // x 坐标
int viewY = viewLocation[1]; // y 坐标
点击获取元素位置,在 onclick 事件中这样写:
int[] viewLocation = new int[2];
view.getLocationInWindow(viewLocation);
int viewX = viewLocation[0]; // x 坐标
int viewY = viewLocation[1]; // y 坐标