老师 你好!请问webview所在的Activity不是主Activity;怎么点击返回键退出到主界面啊??
诺曼蒂克
2014-09-19
4 回答
@诺曼蒂克
public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK){ if(webView.canGoBack()){ webView.goBack(); return true; }else if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction()==KeyEvent.ACTION_DOWN) { //要在这里跳转啊 Intent intent = new Intent(); intent = new Intent(ActivityA.this, ActivityB.class); startActivity(intent); this.finish(); } return super.onKeyDown(keyCode, event); }
举报
0/150
提交
取消