0
프로그래밍 방식으로 마우스 스크롤 이벤트를 주입하는 작업이 있습니다. 스크롤은 수평 및 수직이 될 수 있습니다. 이를 달성하기 위해 ACTION_SCROLL과 함께 MotionEvent를 사용하기로 결정했습니다. 그러나이 이벤트 유형을 초기화하는 방법이 저에게 불분명합니다. AXIS_VSCROLL 및 AXIS_HSCROLL의 스크롤 오프셋을 정의하는 방법은 무엇입니까?ACTION_SCROLL MotionEvent를 획득하는 올바른 방법
MotionEvent.PointerCoords coord = new MotionEvent.PointerCoords();
coord.x = 500f;
coord.y = 500f;
coord.setAxisValue(MotionEvent.AXIS_VSCROLL, 1f);
MotionEvent.PointerCoords[] coords = { coord };
MotionEvent.PointerProperties properties = new MotionEvent.PointerProperties();
properties.toolType = 3;
MotionEvent.PointerProperties[] prop = { properties };
MotionEvent mouseEvent = MotionEvent.obtain(downTime, downTime + 100,
MotionEvent.ACTION_SCROLL, 1, prop, coords, 0, 0, 1f, 1f,
8, 0, 8194, 0);
얻기() 메서드 매개 변수 :
MotionEvent DownTime 91208223
MotionEvent EventTime 91221679
MotionEvent Action 8
MotionEvent PointerCount 1
MotionEvent.PointerCoords x 98.14349
MotionEvent.PointerCoords y 23.289246
MotionEvent.PointerCoords size 0.0
MotionEvent.PointerCoords pressure 0.0
MotionEvent.PointerCoords orientation 0.0
MotionEvent.PointerCoords toolMajor 0.0
MotionEvent.PointerCoords toolMinor 0.0
MotionEvent.PointerCoords toolMinor 0.0
MotionEvent.PointerCoords touchMajor 0.0
MotionEvent.PointerCoords AXIS_HSCROLL 0.0
MotionEvent.PointerCoords AXIS_VSCROLL -1.0
MotionEvent.PointerProperties id 0
MotionEvent.PointerProperties toolType 3
MotionEvent MetaState 0
MotionEvent ButtonState 0
MotionEvent XPrecision 1.0
MotionEvent YPrecision 1.0
MotionEvent DeviceId 8
MotionEvent EdgeFlags 0
MotionEvent Source 8194
MotionEvent Flags 2
그 로그에 내놓고 자신의 이벤트를 얻기 위해 노력 :
내가 USB 마우스에서 실제 스크롤 MotionEvent를 기록하려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
)
'MotionEvent.PointerCoords'를 사용하고'MotionEvent # obtain()'메소드에 전달 하시겠습니까? – pskink
@pskink는 가능한 해결책으로 들립니다. 그러나 나는 긍정적 인 결과를 얻지 못했습니다. –
아마도 'PointerCoords'가 올바르게 초기화되지 않았습니까? 일반적인 값을보기 위해'MotionEvent # getPointerCoords'를 호출하려 했습니까? 또한'3'은 마우스입니까? 왜'downTime + 100'인가? – pskink