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

在Android层实现触摸屏校验

 2010-05-31 14:35:00 来源:WEB开发网   
核心提示:cal.get_sample(direction, (int)event.getX(), (int)event.getY(),xList[direction], yList[direction]);Log.i("XXW", "calibrate_main");cal.calibr

cal.get_sample(direction, (int)event.getX(), (int)event.getY(),

xList[direction], yList[direction]);

Log.i("XXW", "calibrate_main");

cal.calibrate_main();

Toast.makeText(getBaseContext(), "Calibrate Done!", Toast.LENGTH_SHORT).show();

SystemProperties.set("ts.config.calibrate", "done");

AndroidCalibrate.this.finish();

}

direction++;

return false;

}

});

}

public class CrossView extends View {

public CrossView(Context context) {

super(context);

}

public void onDraw(Canvas canvas) {

Paint paint = new Paint();

paint.setColor(Color.GREEN);

if (direction == 0) {

canvas.drawLine(40, 50, 60, 50, paint);

canvas.drawLine(50, 40, 50, 60, paint);

paint.setColor(Color.WHITE);

} else if (direction == 1) {

canvas.drawLine(UI_SCREEN_WIDTH - 60, 50, UI_SCREEN_WIDTH - 40, 50, paint);

canvas.drawLine(UI_SCREEN_WIDTH - 50, 40, UI_SCREEN_WIDTH - 50, 60, paint);

paint.setColor(Color.WHITE);

} else if (direction == 2) {

canvas.drawLine(UI_SCREEN_WIDTH - 60, UI_SCREEN_HEIGHT - 50, UI_SCREEN_WIDTH - 40,

UI_SCREEN_HEIGHT - 50, paint);

canvas.drawLine(UI_SCREEN_WIDTH - 50, UI_SCREEN_HEIGHT - 60, UI_SCREEN_WIDTH - 50,

UI_SCREEN_HEIGHT - 40, paint);

paint.setColor(Color.WHITE);

} else if (direction == 3) {

canvas.drawLine(40, UI_SCREEN_HEIGHT - 50, 60, UI_SCREEN_HEIGHT - 50, paint);

canvas.drawLine(50, UI_SCREEN_HEIGHT - 60, 50, UI_SCREEN_HEIGHT - 40, paint);

paint.setColor(Color.WHITE);

} else if (direction == 4) {

canvas.drawLine(UI_SCREEN_WIDTH / 2 - 10, UI_SCREEN_HEIGHT / 2,

UI_SCREEN_WIDTH / 2 + 10, UI_SCREEN_HEIGHT / 2, paint);

上一页  6 7 8 9 10 11 12 13  下一页

Tags:Android 实现 触摸屏

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