How to Enable Flash Plugin in Webview?

╄→гoц情女王★ 提交于 2019-12-29 04:54:14

问题


How to Enable Flash Plugin in Webview Browser?


回答1:


You just need to enable the plugins for the webview, like this :

WebView mWebView = (WebView) findViewById(R.id.WebView01);
mWebView.getSettings().setPluginsEnabled(true);

I think you also need Flash to be installed, like in Android 2.2 and above. Hope this helps.

This method is now deprecated, I'll try to explain this more in detail. See here




回答2:


I believe that you can

WebSettings webSettings = myWebView.getSettings();
webSettings.setPluginState(PluginState.ON);

will work.




回答3:


setPluginsEnabled() and setPluginsEnabled() are deprecated.

To make Flash Player work in a WebView you need to enable hardware acceleration in your AdroidManifest.xml.

<application
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/appicon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

You can also individually enable it for your WebView by using

mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);



回答4:


try to use this lines of code

webView.getSettings().setPluginState(PluginState.ON);   

instead of using

 webView.getSettings().setPluginsEnabled(true);

Its work fine...




回答5:


webView.getSettings().setPluginState(PluginState.ON); 

is deprecated now, instead use this:

webView.getSettings().setMediaPlaybackRequiresUserGesture(true);



回答6:


  package com.ageofwar2;

    import android.os.Bundle;
    import android.app.Activity;
    import android.view.Menu;
    import android.webkit.WebView;

    public class MainActivity extends Activity {
         /** com.ageofwar2 */
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
        }


        String url ="file:///android_asset/Flash.swf"; //AgeOfWar2.swf
        WebView mWebView=(WebView) findViewById(R.id.web_engine);
        webView.getSettings().setPluginState(PluginState.ON); 
        webview.loadUrl();        


来源:https://stackoverflow.com/questions/2943947/how-to-enable-flash-plugin-in-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!