Android Question Scrollview reset to position

stevenindon

Active Member
Licensed User
Hello all, I have created 2 pages in B4X (MainPage and a MapPage). In the MainPage, I have a Scrollview loaded with a Designer Page as such :

B4X:
    ScrollView1.ScrollViewInnerPanel.LoadLayout("MainMenu")
    ScrollView1.ScrollViewContentHeight=PnlMainmenu.Height

On application start, I scroll down the scroll view to view contents inside the scrollview... then i jump to second page (MapPage). But when i go back to Mainpage (Where the scroll view is), How can i make the scroll view back to its content top position again?

I tried :
Private Sub B4xPage_Appear
ScrollView1.ScrollViewInnerPanel.Top=0 <------------ but this doesn't seems to work
End Sub
 

stevenindon

Active Member
Licensed User
Hi All, Got the answer after searching from forum. This is how it is done :

B4X:
Private Sub B4xPage_Appear
    ScrollView1.As(ScrollView).ScrollToNow(0)
End Sub
 
Upvote 0
Top