Android开发片段 WebView
/** Called when the activity is first created. */WebView mWebView; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); mWebView = (WebView) findViewById(R.id.webView); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setDatabaseEnabled(true); mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setSaveFormData(true); mWebView.setScrollBarStyle(0); mWebView.getSettings().setBuiltInZoomControls(true); mWebView.getSettings().setSupportZoom(true); mWebView.getSettings().setDefaultZoom(ZoomDensity.CLOSE); mWebView.loadUrl("http://10.X.X.X/app/excel/"); mWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url); return true; } }); } public boolean onKeyDown(int keyCode, KeyEvent event) { if (mWebView.canGoBack() && event.getKeyCode() == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) { mWebView.goBack(); return true; } return super.onKeyDown(keyCode, event); }?
?