赞
踩
布局代码如下
- <FrameLayout
- android:id="@+id/webView"
- android:layout_width="match_parent"
- android:layout_height="200dp"/>
@Bind(R.id.webView) FrameLayout frameLayout; WebView webView; webView = new WebView(this); frameLayout.addView(webView); mPlayLink.replace("/pure",""); frameLayout.setVisibility(View.VISIBLE); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setUseWideViewPort(true); // 关键点 webSettings.setAllowFileAccess(true); // 允许访问文件 webSettings.setSupportZoom(true); // 支持缩放 webSettings.setLoadWithOverviewMode(true); webSettings.setPluginsEnabled(true); webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); // 不加载缓存内容 webSettings.setMixedContentMode(android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); webView.setWebChromeClient(new WebChromeClient()); WebViewClient wvc = new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { webView.loadUrl(url); return true; } }; webView.setWebViewClient(wvc); webView.loadUrl(mPlayLink);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。