简体   繁体   English

Android ScrollView检测滚动动画的结束/完成

[英]Android ScrollView detect end of/finished scroll animation

My problem is simple: I would like to detect when ScrollView ended a scroll animation. 我的问题很简单:我想检测ScrollView何时结束滚动动画。

  • We do not have access to the Scroller object of the ScrollView. 我们无权访问ScrollView的Scroller对象。
  • ScrollView.onScrollChanged is not called when it's parameters t and oldt are the same (at the end of the scroll) 当参数t和oldt相同时(在滚动末尾),不会调用ScrollView.onScrollChanged

The only working solution I can find is the one below, it is checking every 100 ms to see if the scroll ended, that sounds horrible to me. 我能找到的唯一可行的解​​决方案是以下解决方案,它每隔100毫秒检查一次滚动是否结束,这对我来说听起来很可怕。 https://stackoverflow.com/a/10198865/1310343 https://stackoverflow.com/a/10198865/1310343

Is there a more elegant solution? 有没有更优雅的解决方案?

Try extending the ScrollView class and override the onScrollChanged method. 尝试扩展ScrollView类并重写onScrollChanged方法。 That should work. 那应该工作。 With the 'getMaxScrollAmount' method you should be able to find if the scrolling is done. 使用“ getMaxScrollAmount”方法,您应该能够找到滚动是否完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM