滚动查看滚动视图中的子视图单击延迟

时间:2021-01-13 01:19:14

I have a webview inside a scrollview with javascript listening click event. It is no problem to listen it in normal case but cannot be listen just after scroll. I need to have a first click to stop the scroll and click one or two times to trigger the click event. Or wait a while until the scrollbar fade out.

我在一个带有javascript监听点击事件的scrollview中有一个webview。在正常情况下听它没有问题,但滚动后不能听。我需要先点击停止滚动,然后单击一两次才能触发点击事件。或等待一段时间,直到滚动条淡出。

I have done a research and know it is normal behavior of scrollview. I have try to set a ontouchlistener on webview to requestDisallowInterceptTouchEvent(true) but just make it cannot able to scroll anymore. Is it there are any approach to cancel the scrolling and perform a click at the same time with no delay in a scrollview?

我做了一项研究,并知道它是scrollview的正常行为。我试图在webview上设置ontouchlistener来requestDisallowInterceptTouchEvent(true),但只是让它无法再滚动。是否有任何方法可以在滚动视图中无延迟地取消滚动并同时执行单击?

1 个解决方案

#1


0  

Finally, I have solved it by reading the document. I just put android:descendantFocusability="blocksDescendants" in the main child view of scrollview and then solve my problem.

最后,我通过阅读文档解决了这个问题。我只是在scrollview的主子视图中放了android:descendantFocusability =“blocksDescendants”,然后解决了我的问题。

For Gopal Singh Sirvi asking, I think you need to put a webview in a scrollview in some cases. Let say the data of one section contains html code. I guess the content page of gmail is also like this. (After open show layout bounds, the content seems inside a webview but others not)

对于Gopal Singh Sirvi问,我认为在某些情况下你需要在滚动视图中放置一个webview。假设一个部分的数据包含html代码。我想gmail的内容页面也是这样的。 (在打开show layout bounds之后,内容似乎在webview中,但其他人没有)

Hope this help!

希望这有帮助!

#1


0  

Finally, I have solved it by reading the document. I just put android:descendantFocusability="blocksDescendants" in the main child view of scrollview and then solve my problem.

最后,我通过阅读文档解决了这个问题。我只是在scrollview的主子视图中放了android:descendantFocusability =“blocksDescendants”,然后解决了我的问题。

For Gopal Singh Sirvi asking, I think you need to put a webview in a scrollview in some cases. Let say the data of one section contains html code. I guess the content page of gmail is also like this. (After open show layout bounds, the content seems inside a webview but others not)

对于Gopal Singh Sirvi问,我认为在某些情况下你需要在滚动视图中放置一个webview。假设一个部分的数据包含html代码。我想gmail的内容页面也是这样的。 (在打开show layout bounds之后,内容似乎在webview中,但其他人没有)

Hope this help!

希望这有帮助!