我正在尝试在我的应用上创建一个 YouTube 链接以在外部窗口/标签中打开。谁能帮我?
这是我的代码:
import com.actionbarsherlock.app.SherlockFragment;
public class Showing_now extends SherlockFragment{
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View mainView = (View) inflater.inflate(R.layout.activity_showing_now, container, false);
WebView webView = (WebView) mainView.findViewById(R.id.webViewsn);
webView.setWebViewClient(new MyWebViewClient());
webView.getSettings().setPluginsEnabled(true);
webView.getSettings().setBuiltInZoomControls(false);
webView.getSettings().setSupportZoom(false);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.getSettings().setAllowFileAccess(true);
webView.getSettings().setDomStorageEnabled(true);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(PluginState.ON);
webView.loadUrl("http://www.myweburl.com");
return mainView;
}
private class MyWebViewClient extends WebViewClient {
}
}