Android的web视图不会处理事件时正确iframe是present [英] Android webview won't handle events correctly when iframe is present

查看:180
本文介绍了Android的web视图不会处理事件时正确iframe是present的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题 - 我有,我通过JavaScript加载我修改的内容文件的iframe(插入文本)网页视图。问题是,当内容变得太大(web视图变为滚动),当用户滚动触摸事件将不会被正确处理 - 即用户将某处挖掘和光标将出现在不适当的位置或将不出现在所有。当没有iframe是present这种行为观察心不是。

I'm having the following issue - I have a webview in which I load an iframe which content document i modify(insert text into) via javascript. The thing is that when the content becomes too much(the webview becomes scrollable) and when the user scrolls the touch events won't be handled correctly - i.e the user will tap somewhere and the cursor will appear on an inappropriate position or won't appear at all. This behaviour isnt observed when no iframe is present.

任何想法如何解决这个问题是受欢迎的。

Any ideas as to how to solve this issue are welcome.

推荐答案

这个问题可能是由于双滚动。

The problem is likely due to double-scrolling.

由于iFrame中有更多的内容比它可以处理,触摸事件被用于滚动的iFrame。但是web视图本身也可以滚动,所以对怪异的行为有很大的潜力。

Since the iFrame has more content than it can handle, touch events are used to scroll the iFrame. But the webview itself can also scroll, so there's a lot of potential for weird behavior.

考虑当iFrame内容的击中边(用户滚动一路向上或向下的iFrame)会发生什么。如果用户继续滚动的iFrame会发生什么?如果它什么也不做,吃的事件吗?反弹的iFrame滚动内容?该事件传递给web视图,因此它可以代替滚动?

Consider what will happen when the iFrame content hits an edge (user has scrolled all the way up or down the iFrame). What should happen if the user continues to scroll the iFrame? Should it do nothing and eat the event? Bounce the iFrame scroll content? Pass the event to the webview so it can scroll instead?

这是一个模糊的情况。基于不同的触摸手势的方式发生反应的Andr​​oid可能不一致,甚至可能在Android的一个版本的不同而不同。

This is an ambiguous situation. The way Android reacts may not be consistent based on different touch gestures, and may even vary from one version of Android to another.

您是好不避免了IFRAME和干脆直接修改的WebView内容,或者给的iFrame 100%的高度和宽度为100%,使其占据整个网页视图。

You're better off either avoiding the iFrame and simply modifying the webview contents directly, or giving the iFrame 100% height and 100% width so that it takes up the entire webview.

这将避免滚动冲突,而Android应停止正在困惑在哪里把光标。

This will avoid scrolling conflicts, and Android should stop being confused about where to put the cursor.

这篇关于Android的web视图不会处理事件时正确iframe是present的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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