首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

Android开发片断 WebView

2012-06-29 
Android开发片段 WebView/** Called when the activity is first created. */WebView mWebView@Overridep

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);      } 
?

?

热点排行