Android 界面编程#6-键盘操作响应
2010-08-23 01:39:00 来源:WEB开发网核心提示:// TODO Auto-generated method stubsuper.onKeyDown(keyCode, event);setTitle("you pressed key:" + String.valueOf(keyCode));return true;}@Overridepublic
// TODO Auto-generated method stub
super.onKeyDown(keyCode, event);
setTitle("you pressed key:" + String.valueOf(keyCode));
return true;
}
@Override
public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
// TODO Auto-generated method stub
super.onKeyMultiple(keyCode, repeatCount, event);
TextView tv = (TextView)this.findViewById(R.id.mainview);
tv.setText("you have press key:[" + String.valueOf(keyCode) + "] for:" + String.valueOf(repeatCount) + "Times!");
return true;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// TODO Auto-generated method stub
super.onKeyUp(keyCode, event);
setTitle("you release key:" + String.valueOf(keyCode));
return true;
}
}
[]
更多精彩
赞助商链接