Android Question Scrollview fullscroll

harinder

Active Member
Licensed User
Longtime User
B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
  If scrollview1.FullScroll(True) Then
        btnAddNew.mBase.visible=True
  End If
End Sub
OR
B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
  If position = scrollview1.FullScroll(True) Then
        btnAddNew.mBase.visible=True
  End If
End Sub
are not working. I am getting a "Cannot assign void value"
 

LucaMs

Expert
Licensed User
Longtime User
This is not a function, it is a method, to scroll the internal panel to the Top (you must pass False) or to the Bottom (pass True)
scrollview1.FullScroll(True)

To check if the bottom is reached:
B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
  If Position = scrollview1.Height Then
        log("Bottom reached")
        btnAddNew.mBase.visible=True
  End If
End Sub
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I think that ScrollView.Position returns the position at the top of the view (for a vertical scroll) so you will need to subtract the height of the view. If your scroll data is 1000 units long and the view is 200 units high then the scroll position will not exceed 800. I would subtract a couple of extra dips just to make sure, and Log the value returned by ScrollView.Position so that you can understand the values that you are working with.
 
Upvote 0
Top