如何获取当前Y向滚动型偏移 [英] How to get the current Y offset of a ScrollView

查看:81
本文介绍了如何获取当前Y向滚动型偏移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

滚动型有一个方法来设置x和y滚动偏移量,但没有一种方法获取当前偏移(所有我真正感兴趣的是y偏移,因为滚动型只支持垂直滚动)。我看不到任何会工作在超类的方法,并试图共达()的内容来看,这始终是零。我失去了一些东西?

ScrollView has a method for setting the x and y scroll offset, but no method for getting the current offset (all I'm really interested is the y offset, since ScrollView only supports vertical scrolling). I don't see any method that would work in the superclasses, and tried getTop() for the content view, which is always zero. Am I missing something?

推荐答案

呼吁的滚动型getScrollY()。在这里看到更多的细节:<一href="http://developer.android.com/reference/android/view/View.html#getScrollY%28%29">http://developer.android.com/reference/android/view/View.html#getScrollY%28%29

Call getScrollY() on the ScrollView. See here for more details: http://developer.android.com/reference/android/view/View.html#getScrollY%28%29

这篇关于如何获取当前Y向滚动型偏移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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