Android webview 退出時關閉聲音 4.視頻全屏 添加cookie

來源:互聯網
上載者:User

標籤:

全屏問題,可以參考 http://bbs.csdn.net/topics/390839259,點擊

webView = (WebView) findViewById(R.id.webView);videoview = (FrameLayout) findViewById(R.id.video_view);chromeClient = new WebChromeClient() {// 播放網路視頻時全屏會被調用的方法@Overridepublic void onShowCustomView(View view, CustomViewCallback callback) {if (islandport) {return;}setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);// if (myCallback != null) {// myCallback.onCustomViewHidden();// myCallback = null;// return;// }webView.setVisibility(View.GONE);if (myView != null) {callback.onCustomViewHidden();return;}videoview.addView(view);myView = view;myCallback = callback;videoview.setVisibility(View.VISIBLE);}private View myView = null;private CustomViewCallback myCallback = null;public void onHideCustomView() {if (myView == null) {return;} else {// if (myCallback != null) {// myCallback.onCustomViewHidden();// myCallback = null;// }setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);myView.setVisibility(View.GONE);videoview.removeView(myView);videoview.setVisibility(View.GONE);webView.setVisibility(View.VISIBLE);myCallback.onCustomViewHidden();myView = null;}}@Overridepublic void onReceivedTitle(WebView view, String title) {// TODO Auto-generated method stubsuper.onReceivedTitle(view, title);if (showtitle) {setTitle(title);}}};WebSettings setting = webView.getSettings();setting.setBuiltInZoomControls(false);setting.setUseWideViewPort(true);setting.setLoadWithOverviewMode(true);setting.setCacheMode(WebSettings.LOAD_NO_CACHE);setting.setPluginState(PluginState.ON_DEMAND);// setting.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); //支援內容重新布局setting.setJavaScriptEnabled(true);setting.setJavaScriptCanOpenWindowsAutomatically(true);

  注意旋轉螢幕

android:configChanges="orientation|keyboardHidden|screenSize"

/** * 當橫豎屏切換時會調用該方法 *  * @author */@Overridepublic void onConfigurationChanged(Configuration newConfig) {super.onConfigurationChanged(newConfig);if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {islandport = true;} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {islandport = false;}}

  而關閉聲音,現在可以參考這裡http://blog.csdn.net/cuizm/article/details/42342505

添加cookies  http://blog.csdn.net/encienqi/article/details/7912733

不建議使用cookie,真的很難用,瀏覽器緩衝就是一個頭疼的問題

Android webview 退出時關閉聲音 4.視頻全屏 添加cookie

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.