I dont speak English, so using onlain-translator.
if something is not clear , ask
In my application, Panel add by Designer and ImageViews adds by code, depending on the value of variable ngame . The problem is: ImageViews is not visible. Panel's are visible. Where is the problem? here is the code:
if something is not clear , ask
In my application, Panel add by Designer and ImageViews adds by code, depending on the value of variable ngame . The problem is: ImageViews is not visible. Panel's are visible. Where is the problem? here is the code:
B4X:
Sub inicio (ngame As Byte, orient As Boolean)
Dim x As Int
If orient=True Then
x=Activity.width
Else
x=Activity.height
End If
If x Mod ngame=0 Then
p1.width=x
Else
Do Until x Mod ngame=0
x=x-1
Loop
End If
p1.width=x
p1.height=p1.width
p1.top=0
p1.left=0
If orient=True Then
p2.width=p1.width
p2.height=Activity.height-p1.height
p2.left=0
p2.top=p1.height
Else If orient=False Then
p2.height=p1.height
p2.width=Activity.width-p1.width
p2.top=0
p2.left=p1.width
End If
'hier I start add imageviews by code
Dim i As Byte
Dim leftx, topy, widthx,heighty As Int
leftx=0
topy=0
widthx=p1.Width/ngame
heighty=widthx
heighty=0
imag=Array As ImageView(im1,im2,im3,im4,im5,im6,im7,im8,im9,im10,im11,im12,im13,im14,im15,im16,im17,im18,im19,im20,im21,im22,im23,im24,im25)
For i=0 To ngame*ngame-1
imag(i).Initialize("im")
p1.AddView(imag(i),leftx ,topy ,widthx,heighty)
leftx=leftx+widthx
If ngame=3 AND i=2 OR i=5 Then
leftx=0
topy=topy+widthx
End If
Next
End Sub