I am trying to make a Browser on Android and it extends WebView class.
There are two functions of my Browser:
1.Could play html5 video tag.
(I enable HardwareAccelerate and setWebChromeClient and it works fine on Android 4.0.)
2.The Browser must have a transparent Background.
(On Android 4.0, just setBackground(0) is not enough. I must also use setLayerType(LAYER_TYPE_SOFTWARE, null).)
But when I use setLayerType(LAYER_TYPE_SOFTWARE, null), the video tag can not paly. And that means setLayerType(LAYER_TYPE_SOFTWARE, null) disable HardwareAccerlarate so the video tag can not work.
So Can I consider that On Android 4.0, the two function is conflicting?Is there any workaround?
//set BackGroundColor
setBackgroundColor(Color.argb(0, 0, 0, 0));
if(android.os.Build.VERSION.SDK_INT>=11){
setLayerType(WebView.LAYER_TYPE_SOFTWARE, null);
}
//set WebChromeClient
setWebChromeClient(new WebChromeClient());
I have to say that, seems no guys met this issue as me.
So I think the two functions mentioned in my question is really conflicting.