Sub Globals
Dim expPnls(9) As expandablePanel
Dim pnls(9) As Panel
Dim sv As ScrollView
Dim limit
End Sub
Sub Activity_Create(FirstTime As Boolean)
limit = 8
Activity.Color = Colors.RGB(232,232,232)
sv.Initialize(100%y)
Activity.AddView(sv,0,0,100%x,100%y)
sv.Color = Colors.Transparent
Dim Top As Int = 0
For i = 0 To 8
' Initialize with the event name (not sure how to combine the events in to one)
expPnls(i).Initialize("expPnls" , "OtraActivity")
' Get a reference to the panel
pnls(i) = expPnls(i).AsPanel
sv.Panel.AddView(pnls(i),10dip,Top,100%x-20dip,300dip)
Top = Top + 300dip + 10dip
pnls(i).Color = Colors.RGB(Rnd(0,255), Rnd(0,255), Rnd(0,255))
' Set up parameters for the expandable panels
expPnls(i).setSpeed(300)
expPnls(i).maxHeight = 300dip
expPnls(i).minHeight = 80dip
' Collapse the panel
expPnls(i).Collapse
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub expPnls_Click(MyExpPnl As expandablePanel)
For i = 0 To limit
If expPnls(i).IsExpanded Then
expPnls(i).Collapse
End If
Next
Log("Top Panel Seleccionado = "&MyExpPnl.AsPanel.Top) 'Muestra la posición top actual del panel seleccionado
Log("ScrollPosition = "&sv.ScrollPosition)
Log("Activity Height = "&Activity.Height)
Log("ScrollView Height = "&sv.Height)
Log("ScrollView Panel Height = "&sv.Panel.Height)
Log("---")
MyExpPnl.ToggleHeight
End Sub
'This is the more important part of the sample
'It will move the surrounding views when it is expanded and collapses
'It is imperative to use the same sub name : "eventname & Resize_Views"
Sub expPnls_Resize_Views
For i = 0 To pnls.Length-1 -1
pnls(i+1).Top = pnls(i).Top+pnls(i).Height + 10dip
Next
sv.Panel.Height = pnls(pnls.Length-1).Top + pnls(pnls.Length-1).Height
sv.Top = (100%y - sv.Panel.Height) / 2 'Tu código
End Sub