It seamed like a good thing at the time......
I have an app that needs to walk through many pics. I have a panel that I create a 3x3 matrix of list views and matching check boxes. Working with an array of objects simplifies a major amount of coding. As far as I know, there is now way of adding or defining an array in the designer script. So I moved this function to the program.
I'm guessing that the auto scaling is the beast that is missing. That is, it looked pretty when it was hard coded in the designer script.
This code is executed on every resume. The check box is supposed to be above the the imageview and all is function, just not pretty. It looks equally messed up in portrait or landscape.
I have an app that needs to walk through many pics. I have a panel that I create a 3x3 matrix of list views and matching check boxes. Working with an array of objects simplifies a major amount of coding. As far as I know, there is now way of adding or defining an array in the designer script. So I moved this function to the program.
I'm guessing that the auto scaling is the beast that is missing. That is, it looked pretty when it was hard coded in the designer script.
B4X:
...
Private IV(9) As ImageView
Private CB(9) As CheckBox
...
Sub SetupView
' set the width of the objects
Dim width As Int = (PAN1.width / 3)
Dim height As Int = (PAN1.height / 3)
' set the spacing of the objects
Dim spacew As Int = (width / 5)
Dim spaceh As Int = (height / 5)
' adjust the views for the spacing
width = width - spacew
height = height - spaceh
Dim a As Int
Dim r As Int = 0
Dim c As Int = 0
For a=0 To 8
IV(a).Initialize("")
CB(a).Initialize("")
PAN1.AddView(IV(a),(r * height) + (spaceh * r),(c * width) + (spacew * c),width,height)
PAN1.AddView(CB(a),(r * height) + (spaceh * r),(c * width) + (spacew * c),width,height)
c = c + 1
If c = 3 Then
c = 0
r = r + 1
End If
Next
End Sub
This code is executed on every resume. The check box is supposed to be above the the imageview and all is function, just not pretty. It looks equally messed up in portrait or landscape.