scroll-offset

Scroll offset of GridView

被刻印的时光 ゝ 提交于 2019-12-23 10:08:15
问题 Is there a way to determine the current scroll offset or scroll position of a GridView? View.getScrollY() // Underlying var is not updated during a scroll. I have tried setting an OnScrollListener but the onScroll callback is not fine grained enough for my purposes. Here is the how I'm attempting to determine the scroll offset using an OnScrollListener. private int getScrollY() { int top = 0; if (mGridView.getChildCount() > 0) { final View firstView = mGridView.getChildAt(0); top = firstView

How to get scroll position from GridView?

只谈情不闲聊 提交于 2019-11-27 15:48:41
问题 I am trying to build my own grid view functions - extending on the GridView . The only thing I cannot solve is how to get the current scroll position of the GridView . getScrollY() does always return 0, and the onScrollListener 's parameters are just a range of visible child views, not the actual scroll position. This does not seem very difficult, but I just can't find a solution in the web. Anybody here who have an idea? 回答1: I did not find any good solution, but this one is at least able to

Android: ListView.getScrollY() - does it work?

寵の児 提交于 2019-11-27 05:14:21
I am using it, but it always returns 0, even though I have scrolled till the end of the list. getScrollY() is actually a method on View, not ListView. It is referring to the scroll amount of the entire view, so it will almost always be 0. If you want to know how far the ListView's contents are scrolled, you can use listView.getFirstVisiblePosition(); It does work, it returns the top part of the scrolled portion of the view in pixels from the top of the visible view. See the getScrollY() documentation. Basically if your list is taking up the full view then you will always get 0, because the top

Android ListView current scroll location Y pixels

懵懂的女人 提交于 2019-11-26 22:20:35
问题 I'm trying to detect when a list view is scrolled beyond certain fixed threshold in pixels (half way through the first item). Unfortunately listview's getScrollY() seems to always return 0 instad of the scroll position. Is there any way to get the actual scroll location by pixel? Here's the code I tried to use but as said it only returns 0. getListView().setOnScrollListener(new AbsListView.OnScrollListener() { public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,

Android: ListView.getScrollY() - does it work?

。_饼干妹妹 提交于 2019-11-26 12:47:02
问题 I am using it, but it always returns 0, even though I have scrolled till the end of the list. 回答1: getScrollY() is actually a method on View, not ListView. It is referring to the scroll amount of the entire view, so it will almost always be 0. If you want to know how far the ListView's contents are scrolled, you can use listView.getFirstVisiblePosition(); 回答2: It does work, it returns the top part of the scrolled portion of the view in pixels from the top of the visible view. See the