标签:android
/** * 模拟点击某个指定坐标作用在View上 * @param view * @param x * @param y */ public void clickView(View view,float x,float y) { long downTime = SystemClock.uptimeMillis(); final MotionEvent downEvent = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_DOWN, x, y, 0); downTime+=10; final MotionEvent upEvent = MotionEvent.obtain( downTime, downTime, MotionEvent.ACTION_UP, x, y, 0); view.onTouchEvent(downEvent); view.onTouchEvent(upEvent); downEvent.recycle(); upEvent.recycle(); }
【android】模拟点击某个指定坐标作用在View上,布布扣,bubuko.com
标签:android
原文地址:http://blog.csdn.net/u011494050/article/details/38457833