Closed eshkoliGilad closed 7 years ago
It would be great if you actually posted the solution to this problem, instead of just saying that you solved it. People are coming here and reading these issues, and it would really be great if, since you managed to solved the issue which is the topic of this thread, you posted your solution to the problem as well.
Hey there,
it took a while to get to this but we've now fixed the crash, feel free to reopen this ticket if it didn't resolve this issue for you.
Martin, 500px
Hi, guys.
when using scrollToPosition() the sample app is crashing when applying 499 as paramter for example with (any item number that is not the first in the row IMHO):
Process: com.fivehundredpx.greedo_layout_sample, PID: 10356 java.lang.IndexOutOfBoundsException: Invalid index 499, size is 499 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.fivehundredpx.greedolayout.GreedoLayoutSizeCalculator.getRowForChildPosition(GreedoLayoutSizeCalculator.java:77) at com.fivehundredpx.greedolayout.GreedoLayoutManager.rowForChildPosition(GreedoLayoutManager.java:262) at com.fivehundredpx.greedolayout.GreedoLayoutManager.scrollToPosition(GreedoLayoutManager.java:290) at android.support.v7.widget.RecyclerView.scrollToPosition(RecyclerView.java:1341) at com.fivehundredpx.greedo_layout_sample.SampleActivity$1.run(SampleActivity.java:42) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Any idea why ?
Anyway, after trying to alter the code I've managed to get the scrollToPosition() to work but with one exception. Please refer to this. any help is appreciated.
Edit: after trying position 498 it worked but it has the same issue as I posted on SO above in the link. See refer image:
So it is pretty much the same. It looks as the recyclerview is scrolling to a position almost at the end of the content so it create "white space" below in order for it to position the scrolled item at the top. any idea why ? Is this normal behavior ?
@JVillella