#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim scHolder As ScrollView
Dim btnOutside As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
scHolder.Initialize(0)
btnOutside.Initialize("btnOutside")
btnOutside.Text = "Do Magic!"
Activity.AddView(scHolder, 0, 0, 100%x, 90%y)
Activity.AddView(btnOutside, 0, 90%y, 100%x, 10%y)
Dim i As Int
For i = 1 To 20
Dim btnInside As Button
btnInside.Initialize("")
btnInside.Tag = i
btnInside.Text = "Inside Button #" & i
btnInside.Gravity = Gravity.CENTER
scHolder.Panel.AddView(btnInside, 10%x, scHolder.Panel.Height, 80%x, 50dip)
scHolder.Panel.Height = scHolder.Panel.Height + 60dip
scHolder.Panel.Invalidate
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnOutside_Click
For Each vView As View In scHolder.Panel.GetAllViewsRecursive
If vView Is Button Then
Dim btnView As Button
btnView = vView
btnView.Text = "Hello #" & btnView.Tag
btnView.Invalidate
End If
Next
End Sub