如何获取当前Y向滚动型偏移

由网友(终归一场梦)分享简介:滚动型有一个方法来设置x和y滚动偏移量,但没有一种方法获取当前偏移(所有我真正感兴趣的是y偏移,因为滚动型只支持垂直滚动)。我看不到任何会工作在超类的方法,并试图共达()的内容来看,这始终是零。我失去了一些东西?ScrollView has a method for setting the x and y scrol...

滚动型有一个方法来设置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()。在这里看到更多的细节: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

阅读全文

相关推荐

最新文章