WEB开发网
开发学院手机开发Android 开发 在Android层实现触摸屏校验 阅读

在Android层实现触摸屏校验

 2010-05-31 14:35:00 来源:WEB开发网   
核心提示:/ (float)device.absSize.range);}switch (orientation) {case Surface.ROTATION_90:temp = scaledX;scaledX = scaledY;scaledY = w-temp;break;case Surface.ROTATION_180

/ (float)device.absSize.range);

}

switch (orientation) {

case Surface.ROTATION_90:

temp = scaledX;

scaledX = scaledY;

scaledY = w-temp;

break;

case Surface.ROTATION_180:

scaledX = w-scaledX;

scaledY = h-scaledY;

break;

case Surface.ROTATION_270:

temp = scaledX;

scaledX = h-scaledY;

scaledY = temp;

break;

}

if (scaledX == 0) {

edgeFlags += MotionEvent.EDGE_LEFT;

} else if (scaledX == display.getWidth() - 1.0f) {

edgeFlags += MotionEvent.EDGE_RIGHT;

}

if (scaledY == 0) {

edgeFlags += MotionEvent.EDGE_TOP;

} else if (scaledY == display.getHeight() - 1.0f) {

edgeFlags += MotionEvent.EDGE_BOTTOM;

}

} else {

scaledX *= xMoveScale;

scaledY *= yMoveScale;

switch (orientation) {

case Surface.ROTATION_90:

temp = scaledX;

scaledX = scaledY;

scaledY = -temp;

break;

case Surface.ROTATION_180:

scaledX = -scaledX;

scaledY = -scaledY;

break;

case Surface.ROTATION_270:

temp = scaledX;

scaledX = -scaledY;

scaledY = temp;

break;

}

}

changed = false;

if (down != lastDown) {

int action;

lastDown = down;

if (down) {

action = MotionEvent.ACTION_DOWN;

downTime = curTime;

} else {

action = MotionEvent.ACTION_UP;

}

currentMove = null;

if (!isAbs) {

x = y = 0;

}

return MotionEvent.obtain(downTime, curTime, action,

scaledX, scaledY, scaledPressure, scaledSize, metaState,

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

Tags:Android 实现 触摸屏

编辑录入:coldstar [复制链接] [打 印]
赞助商链接