滚动视图内部带有按钮,直到第二次单击内部的任何按钮都没有响应 [英] ScrollView with Buttons inside, no response until second click on any button inside
问题描述
我已经花了几天的时间来解决这个问题,但我无法弄清楚.问题是活动简单,布局简单,ScrollView-> LinearLayout->以及布局内部(滚动内容内)有很多按钮.一切正常,但一件棘手的事情.当我单击一个按钮时,假设在滚动内容的顶部,然后立即向下滚动到内容的底部,然后单击该位置的另一个按钮,直到第二次单击都没有任何反应,一切又恢复正常.可以随时复制它,并且它是独立于代码的(我已经尝试了20多种方案).我在Android上还没有太多经验,但是看起来滚动侦听器停止了onClick侦听器之类的工作.任何帮助,将不胜感激.预先谢谢你.
I've been a couple of days trying to solve this thing but I can't figure it out. The problem is, simple activity, with simple layout, ScrollView -> LinearLayout -> and a lot of buttons inside the layout (within the scroll content). Everything works just fine, but one tricky thing. When I click a button, let's say at the top of the scroll content and immediately scroll down to the bottom of the content and click another button there, nothing happens until I click a second time and all comes to normal again. This can be reproduced anytime and it's code independent (I've tried more than 20 scenarios). I don't have much experience in Android yet, but looks like the scroll listener stops the onClick listener or something like that. Any help with this would be much appreciated. Thank you in advance.
PD.如果我以编程方式执行scrollTo()
,而不是用手指手动滚动,那么一切都很好,并且在第一次触摸时单击就会响应.简直让我不知所措.
PD. If I programmatically do a scrollTo()
, instead of manual scroll with my fingers, everything works just fine and the click responds at first touch. It's simply overwhelming me.
推荐答案
一切正常.
开始滚动时,ScrollView
将声明触摸事件,直到您停止触摸屏幕一段时间为止.在Android 2.2中,您会知道何时将滚动视为完成,因为右侧的滚动条会逐渐消失.
When you start scrolling, the ScrollView
will claim touch events until you stop touching the screen for a bit. In Android 2.2, you will know when scrolling is deemed complete, because the scrollbar on the right will fade away.
这篇关于滚动视图内部带有按钮,直到第二次单击内部的任何按钮都没有响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!