【android】模拟点击某个指定坐标作用在View上

	/**
	 * 模拟点击某个指定坐标作用在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】模拟点击某个指定坐标作用在View上

上一篇:记一次特别bug


下一篇:VUE-SVG引用