开发学院手机开发Android 开发 Android多点触摸的实现 阅读

Android多点触摸的实现

 2010-09-10 00:51:00 来源:WEB开发网   
核心提示:} else {Log.w(TAG, "Bad device id: " + ev.deviceId);}}} else {di = getInputDevice(ev.deviceId);// first crack at itsend = preprocessEvent(di, ev);if (

} else {

Log.w(TAG, "Bad device id: " + ev.deviceId);

}

}

} else {

di = getInputDevice(ev.deviceId);

// first crack at it

send = preprocessEvent(di, ev);

if (ev.type == RawInputEvent.EV_KEY) {

di.mMetaKeysState = makeMetaState(ev.keycode,

ev.value != 0, di.mMetaKeysState);

mHaveGlobalMetaState = false;

}

}

if (di == null) {

continue;

}

if (configChanged) {

synchronized (mFirst) {

addLocked(di, SystemClock.uptimeMillis(), 0,

RawInputEvent.CLASS_CONFIGURATION_CHANGED,

null);

}

}

if (!send) {

continue;

}

synchronized (mFirst) {

……………………… .

if (type == RawInputEvent.EV_KEY &&

(classes&RawInputEvent.CLASS_KEYBOARD) != 0 &&

(scancode < RawInputEvent.BTN_FIRST ||

scancode > RawInputEvent.BTN_LAST)) {

/* 键盘按键事件 */

…………………… .

} else if (ev.type == RawInputEvent.EV_KEY) {

/* 下面是 EV_KEY 事件分支,只支持单点的触摸屏有按键事件,

* 而支持多点的触摸屏没有按键事件,只有绝对坐标事件

*/

if (ev.scancode == RawInputEvent.BTN_TOUCH &&

(classes&(RawInputEvent.CLASS_TOUCHSCREEN

|RawInputEvent.CLASS_TOUCHSCREEN_MT))

== RawInputEvent.CLASS_TOUCHSCREEN) {

/* 只支持单点的触摸屏的按键事件 */

…………………………………

} else if (ev.scancode == RawInputEvent.BTN_MOUSE &&

(classes&RawInputEvent.CLASS_TRACKBALL) != 0) {

/* 鼠标和轨迹球 */

……………………… .

} else if (ev.type == RawInputEvent.EV_ABS &&

(classes&RawInputEvent.CLASS_TOUCHSCREEN_MT) != 0) {

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:Android 多点 触摸

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接