当前位置: 动力学知识库 > 问答 > 编程问答 >

cordova - issue with iframe in android

问题描述:

Hi i have used iframe in my android phonegap app.i set the width and height and iframe is scrolling.But the webpage inside the iframe is disabled ie. i cant able to type anything in the webpage textboxes.

If i set the scrolling="no",then iframe is not getting scrolled.But i can able to type in the textboxes.

Here is my code:

<iframe src="http://google.com" width="100%" height="200px" scrolling="no"></iframe>

I can able to scroll the webpage in iframe and also should able to type in textbox.Please help me to solve this problem.Thanks in Advance.

网友答案:

check this once and use it in your onCreate method:

Webview.requestFocus(View.FOCUS_DOWN);
    Webview.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
             switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                case MotionEvent.ACTION_UP:
                    if (!v.hasFocus()) {
                        v.requestFocus();
                    }
                    break;
            }
            return false;

        }
    });
分享给朋友:
您可能感兴趣的文章:
随机阅读: