我有自定义WebChromeClient的WebViews。当某些东西想要在4.2.2或4.3设备上全屏显示时,将调用自定义WebChromeClient的onShowCustomView。但是对于4.4.2(特别是我已经检查过Nexus 7和Galaxy S4设备),它已经使用HTML 5视频,但尝试全屏的Flash视频插件不会调用onShowCustomView。除此之外,Flash视频插件工作正常。
我已经检查过将WebChromeClient添加到4.4.2设备上,它是。
public final WebChromeClient fullscreenWebChromeClient = new WebChromeClient() {
private View fullscreen = null;
private WebChromeClient.CustomViewCallback fullscreenCallback;
@Override
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
fullscreenCallback = callback;
if (fullscreenMode) {
fullscreenCallback.onCustomViewHidden();
return;
}
fullscreen = view;
fullscreenMode = true;
pager.setVisibility(View.GONE);
actionbarGestureDetector.setVisibility(View.GONE);
pageViewWrapper.addView(fullscreen);
}
@Override
public void onHideCustomView() {
super.onHideCustomView();
if (! fullscreenMode) {
return;
}
pageViewWrapper.removeView(fullscreen);
pager.setVisibility(View.VISIBLE);
actionbarGestureDetector.setVisibility(View.VISIBLE);
fullscreenCallback.onCustomViewHidden();
fullscreen = null;
fullscreenMode = false;
}
};
其他地方:
pageWebView.setWebChromeClient(parentActivity.fullscreenWebChromeClient);