iOS Question ScrollView content goes OUT of Scrollview

Mike1970

Well-Known Member
Licensed User
Longtime User
hi everyone, i was using the scrollview but i don't know why if i load a layout in the scrollview, when i scroll it goes out of the scrollview D:

B4X:
scrlInfo.Panel.LoadLayout("info_layout")
scrlInfo.SetShadow(Colors.Black, 0, 0, 0.2, False)
scrlInfo.Visible = False
scrlInfo.ContentHeight = btnContatto.Top +  btnContatto.Height + 50dip
scrlInfo.ContentWidth = scrlInfo.Width

Image-1.png
Image.png


The scrollview has red background, so you can spot it, and the loaded layout is the one with all the text and the red button. As you can see it goes out of the red view when i scroll up
Why?

Thanks
 
Last edited:

Semen Matusovskiy

Well-Known Member
Licensed User
As default, a property 'Bounces' is turned on (at least in designer). Turn off.

I use following subroutine:
B4X:
Public Sub setScrollViewSize (scrollViewInstance As ScrollView, floatWidth As Float, floatHeight As Float, booleanBounces As Boolean)

        scrollViewInstance.Panel.Width   = floatWidth
        scrollViewInstance.Panel.Height  = floatHeight
        scrollViewInstance.ContentWidth  = scrollViewInstance.Panel.Width
        scrollViewInstance.ContentHeight = scrollViewInstance.Panel.Height

        scrollViewInstance.Bounces = booleanBounces
        scrollViewInstance.ScrollTo (0, 0, False)

End Sub
 
Last edited:
Upvote 0

Mike1970

Well-Known Member
Licensed User
Longtime User
As default, a property 'Bounces' is turned on (at least in designer). Turn off.

I use following subroutine:
B4X:
Public Sub setScrollViewSize (scrollViewInstance As ScrollView, floatWidth As Float, floatHeight As Float, booleanBounces As Boolean)

        scrollViewInstance.Panel.Width   = floatWidth
        scrollViewInstance.Panel.Height  = floatHeight
        scrollViewInstance.ContentWidth  = scrollViewInstance.Panel.Width
        scrollViewInstance.ContentHeight = scrollViewInstance.Panel.Height

        scrollViewInstance.Bounces = booleanBounces
        scrollViewInstance.ScrollTo (0, 0, False)

End Sub
It is already turned off from the designer :(

Tomorrow i will take a look to your snippet :D Thanks!
 
Upvote 0
Top