与网页视图Facebook登录对话框中的闪烁 [英] Webview with facebook login flickering in Dialog

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

问题描述

结果
我想和含Facebook登录网站的WebView的对话框。结果
我试着用PopupWindow - 键盘点击文本框后不显示结果。
与AlertDialog相同。最后,我用纯Dialog类,它的工作,但是当我点击文本框整体的WebView闪烁并变成透明的,除了文本框。结果
我文本框后的重点与附加警告框和Facebook登录网站截图。搜索结果
我试着用设置硬件加速或不同的背景,但没有任何效果。
是否有其他的方式在web视图中显示Facebook登录弹出?搜索结果
感谢您的帮助!
code:

 对话对话框=新的对话框(MyActivity.this);
                    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
                    dialog.setContentView(R.layout.webview_popup);
                    dialog.setCanceledOnTouchOutside(真);
                    dialog.setCancelable(真);
                    的WebView popupWebview =(的WebView)dialog.findViewById(R.id.webViewFromPopup);                    popupWebview.loadUrl(URL);                    dialog.show();

XML:

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直
    机器人:ID =@ + ID / popupWindow
    机器人:背景=#000
    安卓了minHeight =600dp的>    <的WebView
        机器人:ID =@ + ID / webViewFromPopup
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:layerType =软件
        机器人:layout_weight =0.8
        机器人:背景=#FFFFFFFF
        />< / LinearLayout中>


解决方案:


我编程的方式构建对话 - 这是解决问题......不知何故。

code:

  / *的WebView弹出* /
    私人对话webViewPopup;私人无效showWebViewPopup(最终字符串URL)
{
    对话的对话=新的对话框(MyActivity.this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.webview_popup);    dialog.setCancelable(真);
    的WebView popupWebview =新的WebView(MyActivity.this);
    的LayoutParams PARAMS =新LinearLayout.LayoutParams(
        LayoutParams.MATCH_PARENT,
        LayoutParams.WRAP_CONTENT,0.99f);
    popupWebview.setLayoutParams(PARAMS);    按钮cancelButton =新按钮(MyActivity.this);
    的LayoutParams bParams =新LinearLayout.LayoutParams(
        LayoutParams.MATCH_PARENT,
        LayoutParams.WRAP_CONTENT,0.01F);
    cancelButton.setLayoutParams(bParams);
    cancelButton.setText(取消);
    cancelButton.setOnClickListener(新OnClickListener(){            公共无效的onClick(视图v){
                webViewPopup.dismiss();
            }
        });    的LinearLayout popupLayout =(的LinearLayout)dialog.findViewById(R.id.popupWindow);
    popupLayout.addView(popupWebview);
    popupLayout.addView(cancelButton);
    dialog.show();    popupWebview.loadUrl(URL);
    webViewPopup =对话框;
}

XML(webview_popup.xml文件)

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent
    机器人:方向=垂直
    机器人:ID =@ + ID / popupWindow
    安卓了minHeight =600dp的
    >< / LinearLayout中>


解决方案

由于字段输入给你的麻烦,一个解决将捕获的数据在自己的形式和处理它在到达web视图。

设置,以便您的EditText视图,当用户在网页视图中选择该领域。键盘弹出


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>

SOLUTION:


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 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>

解决方案

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.

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

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

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