1.当继承TabActivity时,同学们是不是onKeyDown方法没用,那是应为冲突了,可以用dispatchKeyEvent方法
public boolean dispatchKeyEvent(KeyEvent event) { if (event.getKeyCode() == KeyEvent.KEYCODE_BACK &&event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { return false; }}
?
?2.也可以到TabActivity的子Activity用onKeyDown
?
3.当有双重TabActivity时可以用
public boolean onKeyDown(int keyCode, KeyEvent event) {
??????? if(keyCode==KeyEvent.KEYCODE_BACK && event.getRepeatCount()==0){
?????????? ??TouchListenerUtils.Back(this.getParent().getParent());
????????? return false;??????
??????? }else{
??????????? return super.onKeyDown(keyCode, event);
??????? }
??? }
getParent().是指父类的