WTK 配置:修改 WTK22\wtklib\devices\DefaultColorPhone\DefaultColorPhone.properties,將 touch_screen=false 改為 true。
pointerDragged(int x, int y):拖拽(暫未深入研究)pointerPressed(int x, int y):按下,自動調用,x/y 為座標pointerReleased(int x, int y):釋放,類似按下事件protected void pointerPressed(int x, int y) {
switch (status) {
case Consts.S_MENU:
// 菜單區域點擊判斷,計算 menuIndex 調用 doMenuOK
break;
case Consts.S_DRAW_DIBIAO_LIST:
case Consts.S_LOCAL_SEARCH_RESULT:
case Consts.S_MAP_VIEW:
// 左右軟鍵 40x20 區域判斷
if (x < 40 && y > screenHeight - 20) doCommandLeft();
if (x > screenWidth - 40 && y > screenHeight - 20) doCommandRight();
break;
}
}
通過座標區域判斷實現虛擬軟鍵與觸摸菜單交互。