Scroll View Inner Height

Andras

Active Member
Licensed User
Longtime User
Is there any way to change the inner height parameter of a scroll view programatically? I'm looking to set an appropriate height for the number of items to be displayed at any particular time, but don't see how.

Thanks all for help!

John
 

walterf25

Expert
Licensed User
Longtime User
Scrollview inner height

Is there any way to change the inner height parameter of a scroll view programatically? I'm looking to set an appropriate height for the number of items to be displayed at any particular time, but don't see how.

Thanks all for help!

John

You need to do it like this

B4X:
ScrollView1.Panel.Height = 100dip 'whatever height you want to give it
 
Upvote 0

diego

Member
Licensed User
Longtime User
Ok. I'm having problems with different device's resolution. If I set InnerHeight to 1000 and the resolution is 1800, the screen is cut.

is there any way to calculate the heigth according to the device resolution?
 
Last edited:
Upvote 0

diego

Member
Licensed User
Longtime User
I'm using Designer, where you have to put a number in InnerHeight, I supposse this number is pixels, not dip.

So, I must add a line to the source like "ScrollView1.Panel.Height = 1000dip" ?
 
Upvote 0

diego

Member
Licensed User
Longtime User
I think now I got it. I have a TabHost, in one tab I put a scrollview. In another layout I have the views, filled by using %y in the Designer script. I want to fill the whole screen but I don't know the resolution.

then, before loading the layout to the scrollview, setting Scrollview.Panel.Height to 95%y (because tabhost occupies a part of the screen) it fits OK.

So, why use a TabHost? because I want to see similar size of views when you rotate the screen, forcing that horizontally has the same height as vertically.

Finally, I use this:
B4X:
If Activity.Height > Activity.Width  Then
        ScrollView1.Panel.Height = 95%y
Else
        ScrollView1.Panel.Height = 95%x
End If


I'm sure there is a better way to do this, but it seems to work.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In another layout I have the views, filled by using %y in the Designer script. I want to fill the whole screen but I don't know the resolution.
Do you really set the layout with %y values for both orientations ? They will be stretched in portrait and comressed in landscape.
Anyway, you know the Top and Height properties of the view which occupies the lowest position on the ScrollView.Panel.
You must set ScrollView.Panel.Height = LowestView.Top + LowestView.Height + 10dip (10dip is the lower margin, can be different).
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…