scrollView:setScrollHeight() issue

Hi,

Created a vertical scrollView named scroll.

When adding items to the view, scrollHeight updates automatically, but when removing items, it doesnt.

Tried to fix it by running this after removing items:

local sv=scroll:getView() scroll:setScrollHeight(sv.contentHeight)

Printing the values show that numerically this is working.

However, as I remove items from the beginning/top of my scroll, I end up with empty space which I can scroll through.

I would think that by setting the scrollHeight to the new content value, empty space would be truncated/cropped/removed?

Is this wrong or is there a different approach to this?

Thx! Anaqim

If you remove items you have “scrolled past” they will leave empty space… It is up to you to reload those when the scroll goes the other way.  this is what the user would expect to see surely?

If you truly want one-way scroll then you will need to code this yourself without using the widget library - good luck with that. 

thanks for your input,i see your point, but i am trying to understanding what setScrollHeight does.

I can only assume it only expands the height, which seems kinda useless since height is recalculated when adding new objects to the view.

The issue which I am trying to work around is that while the listener will fire an event when I reach the end of the view, allowing me to handle adding elements, with the empty space at the top, no event will fire when scrolling up and reaching the beginning of content, but not the view.

Someone shoot me please!!!  :blink:

I’ve messed around for two weeks now, trying to make a vertical scrollable list using scrollView, when in fact listView does exactly what i need  :wub:

EDIT, I just implemented it in my app, and it works perfectly on my mid end android device  :slight_smile: (cant find the dance emote!)

If you remove items you have “scrolled past” they will leave empty space… It is up to you to reload those when the scroll goes the other way.  this is what the user would expect to see surely?

If you truly want one-way scroll then you will need to code this yourself without using the widget library - good luck with that. 

thanks for your input,i see your point, but i am trying to understanding what setScrollHeight does.

I can only assume it only expands the height, which seems kinda useless since height is recalculated when adding new objects to the view.

The issue which I am trying to work around is that while the listener will fire an event when I reach the end of the view, allowing me to handle adding elements, with the empty space at the top, no event will fire when scrolling up and reaching the beginning of content, but not the view.

Someone shoot me please!!!  :blink:

I’ve messed around for two weeks now, trying to make a vertical scrollable list using scrollView, when in fact listView does exactly what i need  :wub:

EDIT, I just implemented it in my app, and it works perfectly on my mid end android device  :slight_smile: (cant find the dance emote!)