机器人的WebView - 内容不可编辑 [英] android WebView - content not editable

查看:786
本文介绍了机器人的WebView - 内容不可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用的WebView 使用他们的API授权在社交网络上的用户。

我的的WebView 加载与2 EditTexts (或不管他们在网络的发展是所谓的)和形式按钮。

奇怪的问题:在一个的EditText 的形式,但如果该活动被暂停和恢复(例如我preSS点击时,键盘显示不出来家再回来)的 EditTexts 成为可编辑的,我能够进入登录数据。

LogCat中输出的完整过程(打开页面,暂停活动,并回来)低于。是啊,我也注意到拼写为假的错误。任何想法?

  02-24 18:33:16.310:V /的WebView(19204):singleCursorHandlerTouchEvent -getEditableSupport FASLE
 02-24 18:33:16.715:V /的WebView(19204):doShort preSS:mNativeClass  - 1407128米preventDefault  -  0
 02-24 18:33:16.810:D / dalvikvm(19204):GC_CONCURRENT释放299K,48%免费3037K / 5831K,外部604K / 1033K,暂停7毫秒+ 4ms的
 02-24 18:33:16.830:D / navcache(19204):cursorInputFieldAction光标= 39c108,cursorFrame = 1a7928
02-24 18:33:16.830:D / navcache(19204):CachedFrame :: previousInputField此= 1a7928,开始= 39c108,开始= 39c040结束= 39c3c4
02-24 18:33:16.830:D / navcache(19204):CachedFrame :: nextInputField此= 1a7928,开始= 39c108,开始= 39c040结束= 39c3c4
02-24 18:33:16.830:D / navcache(19204):cursorInputFieldAction接下来= 39c16c,preV = 0,行动= 4
02-24 18:33:17.095:V /的WebView(19204):OnSizeChanged:输入
 

解决方案

我已经找到了一些谷歌组中尝试这种

  webview.requestFocus(View.FOCUS_DOWN);
        webview.setOnTouchListener(新View.OnTouchListener(){
            @覆盖
            公共布尔onTouch(视图V,MotionEvent事件){
                开关(event.getAction()){
                    案例MotionEvent.ACTION_DOWN:
                    案例MotionEvent.ACTION_UP:
                        如果(!v.hasFocus()){
                            v.requestFocus();
                        }
                        打破;
                }
                返回false;
            }
        });
 

I use a WebView to authorize a user on a social network using their API.

My WebView loads a form with 2 EditTexts(or whatever they're called in web development) and a button.

The strange issue: the keyboard does not show up when clicking on an EditText in the form BUT if the activity gets paused and resumed (for example I press HOME and then come back) the EditTexts become editable and I'm able to enter login data.

LogCat output for complete procedure (opening page, pausing activity and coming back) goes below. Yeah, I also noticed the wrong spelled "false". Any ideas?

 02-24 18:33:16.310: V/webview(19204):  singleCursorHandlerTouchEvent -getEditableSupport  FASLE 
 02-24 18:33:16.715: V/webview(19204): doShortPress : mNativeClass - 1407128 mPreventDefault -  0
 02-24 18:33:16.810: D/dalvikvm(19204): GC_CONCURRENT freed 299K, 48% free 3037K/5831K, external 604K/1033K, paused 7ms+4ms
 02-24 18:33:16.830: D/navcache(19204): cursorInputFieldAction cursor=39c108, cursorFrame=1a7928
02-24 18:33:16.830: D/navcache(19204): CachedFrame::previousInputField this=1a7928, start=39c108, begin=39c040 end=39c3c4
02-24 18:33:16.830: D/navcache(19204): CachedFrame::nextInputField this=1a7928, start=39c108, begin=39c040 end=39c3c4
02-24 18:33:16.830: D/navcache(19204): cursorInputFieldAction next=39c16c, prev=0, action=4
02-24 18:33:17.095: V/webview(19204): OnSizeChanged: Enter 

解决方案

I have found something in the Google group try this

webview.requestFocus(View.FOCUS_DOWN);
        webview.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                    case MotionEvent.ACTION_UP:
                        if (!v.hasFocus()) {
                            v.requestFocus();
                        }
                        break;
                }
                return false;
            }
        });

这篇关于机器人的WebView - 内容不可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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