简体   繁体   中英

Find View from x y coordinate?

How can i get the view from given xy coordinate ? Actually i am developing Bluetooth mouse driver for android , in which i am receiving x , y coordinates from mouse , so when user click , event will be dispatched to that specific view. I found this code

void simulateEventDown( View v, long x, long y )
{
MotionEvent e = MotionEvent.obtain( SystemClock.uptimeMillis(),
SystemClock.uptimeMillis(),  MotionEvent.ACTION_DOWN, x, y, 0);
v.dispatchTouchEvent(e);
}

to dispatch the event , but i don't know the view at x,y . Any help thank you .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM