我正在尝试使用MotionEvent.obtain()模拟多点触控事件。这可以使用 API9 和 API14 中引入的方法来完成:
API 9:
public static MotionEvent obtain (long downTime, long eventTime, int action, int pointerCount, int[] pointerIds, PointerCoords[] pointerCoords, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags)
API 14:
public static MotionEvent obtain (long downTime, long eventTime, int action, int pointerCount, PointerProperties[] pointerProperties, PointerCoords[] pointerCoords, int metaState, int buttonState, float xPrecision, float yPrecision, int deviceId, int edgeFlags, int source, int flags)
但是,我的应用程序需要支持 API >= 7。该 API 下面的最新方法是
API 5:
public static MotionEvent obtain (long downTime, long eventTime, int action, int pointerCount, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int deviceId, int edgeFlags)
它确实接受pointerCount,但只接受其中一个指针的坐标。所以我不确定如何使用这种方法来模拟多点触控。
有任何想法吗?