Android webview旋转屏幕导致页面重新加载问题解决办法
1. 在create时候加个状态判断
protected void onCreate(Bundle savedInstanceState){ ... if (savedInstanceState == null) { mWebView.loadUrl("your_url"); } ... }
2. 重载保存状态的函数:
@Override protected void onSaveInstanceState(Bundle outState ) { super.onSaveInstanceState(outState); mWebView.saveState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mWebView.restoreState(savedInstanceState); }