Android Question Scrollview panel height question

Gerardo52

Member
Licensed User
Hi to everyone.

I have this code inside firstime of an activity:

B4X:
ScrollView1.Left = 0
        ScrollView1.Width = Activity.Width
 
        ScrollView1.Panel.AddView(ImageView1,0dip,0dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView2,0,1*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView3,0,2*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView4,0,3*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView5,0,4*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView6,0,5*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView7,0,6*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView8,0,7*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView9,0,8*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView10,0,9*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView11,0,10*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView12,0,11*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView13,0,12*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView14,0,13*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView15,0,14*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView16,0,15*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView17,0,16*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView18,0,17*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView19,0,18*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView20,0,19*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView21,0,20*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView22,0,21*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView23,0,22*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView24,0,23*170dip,Activity.Width,160dip)
        ScrollView1.Panel.AddView(ImageView25,0,24*170dip,Activity.Width,160dip)
 
        ScrollView1.Panel.Height = 25*170dip
The result is not how I expect, because the ScrollView1.Panel.Height never result exactely the sum of all the imageview Height. Alway more or less (in this case very less).

What is my mistake? Someone know what is the correct way todo?

Thank you
 
Last edited:

Gerardo52

Member
Licensed User
Hi Erel
I never used this solution.
Have you some good example with images involved?
My app is quite finished, this issue is the last I have.
From your reply I presume is not easy to do with scrollview, right?

Thank you indeed
 

Erel

Administrator
Staff member
Licensed User

Gerardo52

Member
Licensed User
Hi to all

Just fixed the scrollview issue:
In my designer layout the scrollview had an height greater than the activity height.
Just when set an height (Distance from bottom border) minor (positive value, not negative) than that all works fine.

And this is the code that set the parameter in the runtime:
B4X:
ScrollView1.Panel.Height = DipToCurrent(25*170)
Thank you so much Erel for support.
 
Top