Comments (9)
Is there any workarounds to get the scroll position? The thing i need is to know when the list is scrolled to the bottom so I can load new data.
from staggeredgridview.
Here's how I tried to tackle the problem
First ,add a private instance :
private AbsListView.OnScrollListener mOnScrollListener;
Add public setOnClickListener method :
public void setOnScrollListener (AbsListView.OnScrollListener l) {
mOnScrollListener = l;
}
Then, in trackMotionScroll
, add lines of codes to invoke the listener
private boolean trackMotionScroll(int deltaY, boolean allowOverScroll) {
.
.
.
/* HERE we call onScroll */
if (mOnScrollListener != null) {
mOnScrollListener.onScroll(null, getFirstPosition(), getChildCount(), this.mItemCount);
}
return deltaY == 0 || movedBy != 0;
}
You can also implement your own onScrollStateChanged (AbsListView view, int scrollState)
method, but I am too lazy to do so :P
Finally you can call gridView.setOnScrollListener(listener)
to pass in a listener to StaggeredGridView
Hope it helps.
from staggeredgridview.
I added the support in my version https://github.com/GoMino/StaggeredGridView, I still need to merge the code with this version of the StaggeredGridView, I based mine on the original one in the support library.
from staggeredgridview.
Does this fix the setscroll ?
from staggeredgridview.
It works exactly the same as any other scroll listener:
private OnScrollListener mScrollListener = new OnScrollListener() {
@Override
public void onScrollStateChanged(ViewGroup view, int scrollState) {
Log.d(TAG, "[onScrollStateChanged] scrollState:" + scrollState);
switch (scrollState) {
case SCROLL_STATE_IDLE:
break;
case SCROLL_STATE_FLING:
break;
case SCROLL_STATE_TOUCH_SCROLL:
break;
default:
break;
}
}
@Override
public void onScroll(ViewGroup view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
Log.d(TAG, "[onScroll] firstVisibleItem:" + firstVisibleItem + " visibleItemCount:"+visibleItemCount + " totalItemCount:" + totalItemCount);
}
};
then you set the listener via youStaggeredGridView.setOnScrollListener(mScrollListener), and you will get notified!
from staggeredgridview.
What I mean is does the setScrollY or scrollTo function work, course if i try i use it i just get weird results.
from staggeredgridview.
I remember getting a similar issue when I used that version of the StaggeredGridView, that is why I decided to rebase my work on the original one from the support library which doesn't have the problem, I would suggest you to try it out and let me know if you got any problem with it
from staggeredgridview.
where do i find the original and what is the downsides with using that one?
Edit: Didn't read properly will try your library!
from staggeredgridview.
I can get how many pixels I moved?
from staggeredgridview.
Related Issues (20)
- Staggered Grid View Height issue
- add scrollbar
- Having issue while using custom Typeface, it affects smooth scrolling of StaggeredGridView
- setOnItemLongClickListener not work's :/
- Header, Footer is not supported HOT 1
- notifyDataSetChanged not working HOT 2
- DPad Selection
- Error in StaggeredGridView.java
- Is there any way to display vertical scroll bar?
- ArrayIndexOutOfBoundsException
- SGV.onMeasure() does not recalculate mColumnTops/Bottoms/Lefts when SGV dimension changes HOT 2
- Set listSelector HOT 1
- auto set width and height StaggeredGridView Item
- No SetSelection(int index) method HOT 2
- Cannot show content below staggered gridview HOT 1
- scrollbar
- SwipeRefreshLayout HOT 3
- Missing support for RTL layout
- Is it possible to set a header view crossing columns?
- Error inflating class com.origamilabs.library.views.StaggeredGridView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from staggeredgridview.