Webview与Facebook登录闪烁在对话框 [英] Webview with facebook login flickering in Dialog

查看:228
本文介绍了Webview与Facebook登录闪烁在对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想与包含facebook登录网站的webview进行对话。

我尝试使用PopupWindow - 点击文本框后键盘没有显示。

与AlertDialog相同。最后我使用纯对话框类,这是工作,但是当我点击文本框时,整个webview是闪烁的,并且变成透明的textfield。

我附加了警告框和Facebook登录网站的截图,文本重点。


我尝试设置硬件加速或不同的背景,但没有任何效果。
还有其他方式在webview中显示Facebook登录弹出窗口?


感谢任何帮助!
代码:


I want to make a dialog with webview containing facebook login site.
I tried with PopupWindow - keyboard wasn't showing after clicking on textfield.
The same with AlertDialog. Finally I used pure Dialog class and it's "working", but when I am clicking on textfield whole webview is flickering and turns into transparent besides textfield.
I am attaching screenshot with alert box and facebook login website after textfield focus.

I tried with setting hardware accelerating or different background but without any effects. Is there other way to display facebook login popup in webview?

Thanks for any help! Code:

Dialog dialog = new Dialog(MyActivity.this);
                    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                    dialog.setContentView(R.layout.webview_popup);
                    dialog.setCanceledOnTouchOutside(true);


                    dialog.setCancelable(true);
                    WebView popupWebview = (WebView)dialog.findViewById(R.id.webViewFromPopup);

                    popupWebview.loadUrl(url);

                    dialog.show();

XML:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/popupWindow"
    android:background="#000" 
    android:minHeight="600dp">

    <WebView
        android:id="@+id/webViewFromPopup"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:layerType="software"
        android:layout_weight="0.8" 
        android:background="#FFFFFFFF"
        />

</LinearLayout>


解决方案:

以编程方式构建对话 - 它解决问题...不知何故。

代码:

I am building dialog programmatically - it's solving problem... somehow.
Code:

    /* webview popup */
    private Dialog webViewPopup;            

private void showWebViewPopup(final String url)
{
    Dialog dialog = new Dialog(MyActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.webview_popup);

    dialog.setCancelable(true);
    WebView popupWebview = new WebView(MyActivity.this);
    LayoutParams params = new LinearLayout.LayoutParams(
        LayoutParams.MATCH_PARENT,
        LayoutParams.WRAP_CONTENT, 0.99f);
    popupWebview.setLayoutParams(params);

    Button cancelButton = new Button(MyActivity.this);
    LayoutParams bParams = new LinearLayout.LayoutParams(
        LayoutParams.MATCH_PARENT,
        LayoutParams.WRAP_CONTENT, 0.01f);
    cancelButton.setLayoutParams(bParams);
    cancelButton.setText("Cancel");
    cancelButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                webViewPopup.dismiss();
            }
        });

    LinearLayout popupLayout = (LinearLayout) dialog.findViewById(R.id.popupWindow);
    popupLayout.addView(popupWebview);
    popupLayout.addView(cancelButton);
    dialog.show();

    popupWebview.loadUrl(url);
    webViewPopup = dialog;
}

XML:(webview_popup.xml文件)

XML: (webview_popup.xml file)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/popupWindow"
    android:minHeight="600dp"
    >

</LinearLayout>


推荐答案

由于字段的输入给您带来麻烦,一个工作是以您自己的形式捕获数据,并在到达Webview时处理该数据。

Since the input of the fields is giving you trouble, one work around would be to capture that data in your own form and process it upon reaching the webview.

设置它,以便您的edittext视图和键盘弹出一个用户选择webview中的字段。

Set it up so that your edittext view and keyboard popup when a user selects the field in webview.

这篇关于Webview与Facebook登录闪烁在对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆