Partial-screen WebView with <video> cut in half

风格不统一 提交于 2019-12-03 11:38:11

The problem seems to be with the hardware/opengl layer. Since the VideoView uses an hardware layer to render the video I believe that the same happens with the webView with a video.

So if you set the layers right, they shouldn't interfere with each other, so like I said on the coments, you should set the ListView to layer none or software, to disable the hardware acceleration and enable it on the webView or the window.

More info about the hardware acceleration at http://developer.android.com/guide/topics/graphics/hardware-accel.html#controlling

I had the same problem, it had to with me using a relative layout. The layer it renders the video to, does not move with the webview. So it will render the video as if the webview was positioned at 0,0.

You can work around this by actually position the webview at 0 0, behind any components that may already be there. Then in css give the content a margin to position it on the correct spot.

It may not be clean, but I haven't found another solution.

EDIT: After taking a better look at your question I think it doesn't have anything to do with the relative layout as you're not using one. Nevertheless this workaround worked for me. So I guess the 'Video layer' stays at 0,0 no matter what layout you're using. I only came across this problem on a Galaxy Tab 2(android 4.0.3) by the way.

I had the same issue in a master/detail flow layout. By setting the layer type to software my video being cut in half issues were gone. This turns off hardware acceleration for the webview.

webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

FYI I only experienced this issue on Amazon Tablets.

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