Closed hosseinaminii closed 6 years ago
That's what MeasurableAdapter
is for.
I used MeasurableAdapter but it still does not scroll smoothly.
You'll need to be more specific.
The MeasurableAdapter isn't working correctly. I did implemented the "getViewTypeHeight" like you did in sample project and the fast scroll still working wrong.
Can you please provide an example? The thing I'm having trouble with is 'it's not working' which doesn't really tell me much about the problem.
I didn't write the measurable adapter aspect of this project, so I'm not able to just imagine how you're using it and in which way it's not working.
Feel free to post some code, or provide a fork which demonstrates the problem.
I'm using a recycler view with two view types, each view type has a different height. My adapter implements MeasurableAdapter and implements the method "getViewTypeHeight".
@Override public int getViewTypeHeight(RecyclerView recyclerView, int viewType) { if(viewType == adapter.VIEW_TYPE_ITEM){ return recyclerView.getResources().getDimensionPixelSize(R.dimen.favorites_heigth); } else{ return recyclerView.getResources().getDimensionPixelSize(R.dimen.sections_heigth); } }
When i run the project and test the fast scroll the screen is shaking. Every time that a view with sections height start appear at screen bottom the screen shake and the thumb loses the correct position.
I was able to reproduce this by creating an adapter with interwoven view types of different heights (i.e. an adapter where even rows have a height of 100dp and odd rows have a height of 50dp). It's caused by FastScrollRecyclerView.scrollToPositionAtProgress(...)
not taking the MeasurableAdapter
into account when it computes the view to scroll to.
I'll go ahead and open a PR once I've gotten this fixed.
I have a Recycleview header Item with 40dp height and other Items height are dynamic. What I have to do in this case?
Hello I have 3 types of view in my RecyclerView with different heights. In my case RecyclerView-FastScroll dose not work correctly. Is it possible to fix it?
Thanks