Alex Rivera | Logout

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

Asked 2010-12-11T17:58:08.973
10

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 consider the WebView's boundings: The Flash content is displayed even if the WebView is too small to show the complete page and the Flash content is not inside the WebView's boundings. Moreover this Flash content overlays other (native) layout elements that are displayed next to the WebView. To me, it seems, that the Flash content is rendered in (special) z-Layer, that overlays all other layout elements.

Tested with: Android 2.2 and Flash 10.1.

Is this a known bug in Adobes Flash player 10.1?

Edit
Report

2 Answers

4

I had the same issue with flash. What I found out is that flash view is added with setZOrderOnTop set to true. It causes that flash is rendered on top of all windows (e.g. covers other native layout elements).

I had my own WebView class and I overridden addView methods. When WebView adds any view I check if it is a flash view (by checking "com.adobe.flashplayer.FlashPaintSurface"). If it is I set Z order to false:

@Override
public void addView(View child, int index)
{
    if (child.getClass().getName().equals("com.adobe.flashplayer.FlashPaintSurface"))
    {
        ((SurfaceView)child).setZOrderOnTop(false);
    }

    super.addView(child, index);
}

I do it for every addView method. It works for me and I thought that I will share it.

answered 2012-07-26T14:08:55.990
0

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.

answered 2012-03-01T09:16:13.583

Your Answer