Android: Flash content breaks WebView boundings and overlaps native layout elements

后端 未结 4 709
-上瘾入骨i
-上瘾入骨i 2020-12-16 02:04

I\'m using a WebView to display a web page which contains some Flash content which basically works pretty well. The big problem is, that the Flash content seems not to consi

4条回答
  •  不知归路
    2020-12-16 02:50

    If it is possible to abstain from the Flash content you can just use the Websettings to disable plugin support.

        webView = (WebView) findViewById(R.id.webview);
        WebSettings settings = webView.getSettings();
        // deprecated only for API < 8
        settings.setPluginsEnabled(false);
        // for API > 8 recommended
        settings.setPluginState(PluginState.OFF);
    

    If this code doesn't disable the flash plugin and you want to run your App vor API < 8 just delete...

       settings.setPluginsEnabled(true);
    

    ...if your are using it in your Websettings without setting the bool to false - that has worked for me! I know that this approach isn't always a solution, but in my case it worked, because the flash content was just an unimportant banner.

提交回复
热议问题