这有帮助吗?
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch (keyCode) {
case KEYCODE_HOME:
//do whatever
break;
case KEYCODE_MENU:
//do whatever
break;
case KEYCODE_VOLUME_DOWN:
case KEYCODE_VOLUME_UP:
break;
return true;
}
return false;
}