Dim panels(3) As Panel
Dim images() As String = Array As String("front_page_crn.png", _
"sleep_crn.png", "concentrate_crn.png")
For i = 0 To panels.Length - 1
panels(i).Initialize("panels")
panels(i).Color = Colors.RGB(Rnd(0, 255), Rnd(0, 255), Rnd(0, 255))
Dim lbl As Label
lbl.Initialize("")
lbl.Text = "I'm Panel: " & i
lbl.TextSize = 20
lbl.TextColor = Colors.White
panels(i).AddView(lbl, 20%x, 40%y, 60%x, 30dip)
Dim slika As ImageView
slika.Initialize ("Slika")
slika.Bitmap = LoadBitmapSample(File.DirAssets, images(i), 100%x, 100%y)
slika.Gravity = Gravity.FILL
panels(i).AddView (slika, 0,0,100%x,100%y - 60dip)
Activity.AddView(panels(i), 100%x, 0, 100%x, 100%y - 60dip) 'add the panel to the layout
Activity.AddMenuItem("Panel #" & i, "Menu")
Next
'add the Left and Right button
btnLeft.Initialize("Left")
btnLeft.Text = "Left"
Activity.AddView(btnLeft, 10%x, 100%y - 55dip, 100dip, 50dip)
btnRight.Initialize("Right")
btnRight.Text = "Right"
Activity.AddView(btnRight, 60%x, 100%y - 55dip, 100dip, 50dip)