Android Question ScrollView and setScrollPosition

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi
I am using a scrollview. Its inner panel is obviously higher of the visible part. I am adding rows when I get data from an external input, not using the scrollview with fingers. I have difficulties to scroll the view, one line up, when the last row reaches the bottom of the visible panel of the scrollview. Normally it should be something like SetScrollPosition, but, despite I have read that setScrollposition should exist.. it doesn't .. Here, some people call "ScrollView" the "ListView", and so some posts report solutions that don't exist for ScrollView. I just find a ScrollToNow function, which behavior is not so clear .. What am I missing? Thanks in advance.
 

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
If those are the only functions available, it means that I must do a function working on pixels. Good to know. Thanks for your answer.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Let me finally fix the ideas, if possible, because I am not familiar with these concepts.
1) the internal panel should have InnerHeight=MaximumNumberOfExpectedRows*RowHeightInPixels
2) the visible part of the Panel is a "window" on the InnerPanel, displaying rows from InitialRow*RowHeight to FinalRow*Rowheight.
Thanks for your patience.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi Klaus
Another doubt that I have is about memory: defining a big InnerPanel is a problem? I mean: sometimes one doesn't know how many rows to expect. In that case, to avoid improper behavior, one could define a rather oversized InnerPanel. Of course not a nice choice, but, if no other possibility...
By the way, for comfort of somebody, I report here the code to scroll one line up (only), when the row Irow reaches the end of visible panel:
B4X:
Dim ScrollViewX as ScrollView
Dim LineHeight,nRowsPag,pos As Int 
nRowsPag=ScrollViewX.Height/LineHeight 
pos=LineHeight*(Irow-nRowsPage)
If pos>0 Then ScrollViewX.ScrollPosition=pos

Thanks for your attention
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Thanks. Memory consumption (for nothing) was one of my worries. By the way I noticed that my mechanism to scroll fails if the ScrollList is scrolled manually. A much more sophisticated management is necessary in that case, to keep in account the real part of the inner panel that is shown. I will also examine the CustomListView. Best regards.
 
Upvote 0
Top