#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim clrs(2) As Int
Dim newbutton As Button
Dim newbutton2 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
newbutton.Initialize("newbutton")
newbutton2.Initialize("newbutton2")
Activity.AddView(newbutton,50%x,50%y,100dip,100dip)
Activity.AddView(newbutton2,75%x,75%y,50dip,50dip)
newbutton.Text = "test"
newbutton2.Text = "test"
Dim grad As GradientDrawable
clrs(0) = Colors.Blue
clrs(1) = Colors.red
grad.Initialize("LEFT_RIGHT",clrs)
For Each v As View In Activity.GetAllViewsRecursive
If v Is Button Then
Dim b As Button = V
b.Background = grad
End If
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub newbutton_Click
Dim grad As GradientDrawable
clrs(0) = Colors.Blue
clrs(1) = Colors.red
grad.Initialize("LEFT_RIGHT",clrs)
For Each v As View In Activity.GetAllViewsRecursive
If v Is Button Then
Dim b As Button = v
b.TextColor = Colors.cyan
b.Background = grad
End If
Next
End Sub