【问题标题】:Android ICS 4.0 Placing Flash WebView into full screen calls hideAll Method?Android ICS 4.0 将 Flash WebView 放入全屏调用 hideAll 方法?
【发布时间】:2020-03-19 13:01:50
【问题描述】:

我刚刚进行了一些调查,试图更新我的 ICS 应用程序。当通过 html 或长按 flash 内容将我的 WebView flash 内容放入全屏时,整个内容在搜索 Android ICS 源后就会消失,我在

android.webkit.PluginFullScreenHolder

PluginFullScreenHolder

public void show() {
    // Other plugins may attempt to draw so hide them while we're active.
    if (mWebView.getViewManager() != null)
        mWebView.getViewManager().hideAll();

    WebChromeClient client = mWebView.getWebChromeClient();
    client.onShowCustomView(mLayout, mOrientation, mCallback);
}

void hideAll() {
    if (mHidden) {
        return;
    }
    for (ChildView v : mChildren) {
        v.mView.setVisibility(View.GONE);
    }
    mHidden = true;
}

它基本上将我的整个 WebView 隐藏在全屏选择中,现在这不会在默认浏览器中发生,并且无法访问此方法。我该如何解决这个问题?

非常感谢任何帮助。

最好的

大卫

【问题讨论】:

    标签: android webview


    【解决方案1】:

    在这里查看我的答案:

    flash player crashes when trying to enter fullscreen mode android 4.0

    这就是我解决这个问题的方法。希望对您有所帮助。

    【讨论】:

    • 嘿,是的,我修复了在文章前面发现的崩溃。我现在的问题是,当您将 Flash 放入全屏时,ICS 类会生成 webview 视图,View.GONE....
    【解决方案2】:

    我通过覆盖onShowCustomView 方法解决了上述问题。 请尝试这是否适合您。下面是我的代码。

    mWebView.setWebChromeClient(new WebChromeClient(){
    
            public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback){
                super.onShowCustomView(view, callback);   
                if(Build.VERSION.SDK_INT >=14) {
                    if (view instanceof FrameLayout) {                  
                        base.addView(view, new FrameLayout.LayoutParams(
                        ViewGroup.LayoutParams.FILL_PARENT,
                        ViewGroup.LayoutParams.FILL_PARENT,
                        Gravity.CENTER));                   
                        base.setVisibility(View.VISIBLE);
                    }
                }
            }
    
        });
    

    【讨论】:

    • 这段代码 sn-p 的基础是什么?它是顶层窗口装饰视图吗?
    【解决方案3】:

    以西蒙的回答为基础,我得到了它的工作。我有一个FrameLayout 作为WebView 的父级。这是西蒙回答的基础。在onCreate 中,我构建了webview 并将其添加到我的FrameLayout 中,称为mWebContainer

    mWebView.setWebChromeClient(new WebChromeClient(){
                public void onShowCustomView(View view, int requestedOrientation, WebChromeClient.CustomViewCallback callback){
                    super.onShowCustomView(view, callback);   
                    if(Build.VERSION.SDK_INT >=14) {
                        if (view instanceof FrameLayout) {   
                            mWebContainer.addView(view, new FrameLayout.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT,
                            ViewGroup.LayoutParams.MATCH_PARENT,
                            Gravity.CENTER));                   
                            mWebContainer.setVisibility(View.VISIBLE);
                        }
                    }
                }
            });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-05
      • 2013-12-11
      • 1970-01-01
      • 2012-05-19
      相关资源
      最近更新 更多