In my app, there is a chat screen and different types of messages. When messages are increased, the memory used by an app is also increasing so I am using Offset and limit in Each (Given in your Endless Scrolling Example). Now Memory optimisation is working but when Start or End Scrolled is triggered, scrollview is not scrolling properly and it hangs some time in scrolling. I’ve used Deferred for my all messages layouts. Also, some contents are not showing if we scroll fast.
I have created a sample project for that. Please check it:
limit, as well as the
Scrolled elements should be enough to fix this, you are most likely giving the
ScrollView too little at a time, which will make the
Scrolled elements behave weirdly.
Can you tell me what’s wrong with my code so I can fix it because I have set Scrolled elements for setting Offset value?
Okay, so without diving too deep into your code, here’s something that I’d like to share. The article on endless scroller example states, specifically:
It is important that we set the limit variable high enough so that the items take up a big enough space in the ScrollView to avoid unnecessary Scrolled triggering as we change the offset. We must also change the offset by a number that is just right: low enough so that the list can be pre-populated quickly, and high enough to avoid loading new items too frequently.
What this means is, essentially, that your items should take up a given amount of screen space for the whole thing to work right. It’s very important that you also use
WhileBusy together with
Deferred so that the placeholders have something to show while the content has not yet arrived. In your case, the
Height of all the messages is initially zero. So the result of it not being smooth is not really surprising.
Lucky for you, an improved trigger for endless scrolling has recently been added: ScrollViewPager. We have only had the time to make this little example showing its use. Perhaps you could give it a try, since it should behave better than the approach in the example linked above.
To build on what Uldis wrote above, adding more objects to the list, using a limit of
40 for the
Each, and setting the
Within="140" makes the scroller scrollable, but you might want to poke a bit around with it yourself, and probably check out some of the possibilities mentioned above, which might be more forward-thinking.