Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 428
janjonas Avatar asked Dec 11 '10 17:12

janjonas


1 Answers

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.

like image 81
pzyho Avatar answered Oct 02 '22 04:10

pzyho