Android Question Keep scrollview position to rotate the screen

rscheel

Well-Known Member
Licensed User
Longtime User
Hi, I need to maintain the position of scrollview to rotate the screen.

I've searched the forum but found nothing concrete.

Thanks for your time.

I tested receive the scroll with this position but I do not get anything, only 0

B4X:
Sub ScrollView1_ScrollChanged(Position As Int)
   
End Sub
 

rscheel

Well-Known Member
Licensed User
Longtime User
It would be something like the following code, the truth does not work for me, you miss me something, or am doing wrong.

B4X:
Sub Process_Globals
    Dim PosicionScroll As Int
End Sub

Sub Globals
    Private ScrollView1 As ScrollView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("LayoutMain")
    ScrollView1.Initialize(700dip)
    pContent.AddView(ScrollView1,0,0,100%x,100%y)
    ScrollView1.Panel.LoadLayout("LayoutCont")
End Sub

Sub ScrollView1_ScrollChanged(Position As Int)
    PosicionScroll = Position
End Sub

Sub Activity_Resume
    ScrollView1.ScrollPosition = PosicionScroll
End Sub
 
Upvote 0
Top