#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
Dim iml As ClassMyLayout
Dim imb As ClassMyButton
Dim Panel1 As Panel
Dim Panel2 As Panel
Dim lbl As Label
Dim Panel3 As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
imb.Initialize
iml.Initialize
iml.SettingLayoutPanel(Activity,Panel1)
lbl.Initialize("")
lbl.Text = "ClassMyButton"
lbl.TextColor = Colors.White
lbl.TextSize = 14
lbl.Typeface = Typeface.DEFAULT_BOLD
imb.NewButton4(Panel2,lbl.Text,"",255,50,100,110,True,1,False,lbl)
lbl.TextSize = 34
lbl.TextColor = Colors.ARGB(200,222,222,222)
imb.NewButton4(Panel3,lbl.Text,"Maps.png",255,50,100,110,True,1,False,lbl)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Globals
Dim imb As ClassMyButton
Dim iml As ClassMyLayout
Dim imi As ClassMyIntent
end sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
iml.Initialize
imi.Initialize
imb.Initialize
iml.SettingLayoutPanel(Activity,Panel1)
lbn.Initialize("lbn")
lbn.Text ="Vinci per la vita"
lbn.TextColor = Colors.ARGB(200,255,255,255)
lbn.TextSize = 22
lbn.Typeface = Typeface.DEFAULT_BOLD
lbn.Gravity = Gravity.CENTER_HORIZONTAL
lbn.Gravity = Gravity.CENTER_VERTICAL
Dim col1, col2 As Int
col1 = Colors.ARGB(220,50,100,150)
col2 = Colors.ARGB(255,0,0,0)
imb.NewButtonRec(Panel1,lbn,"android.png",col1,col2,True,1,False)
End Sub
iml.SettingLayoutPanel(Activity,Panel1)
lbn.Initialize("lbn")
lbn.Text ="Vinci per la vita"
lbn.TextColor = Colors.ARGB(200,255,255,255)
lbn.TextSize = 22
lbn.Typeface = Typeface.DEFAULT_BOLD
lbn.Gravity = Gravity.CENTER_HORIZONTAL
lbn.Gravity = Gravity.CENTER_VERTICALDim col1, col2 AsInt
col1 = Colors.ARGB(220,50,100,150)
col2 = Colors.ARGB(255,0,0,0)
' panel, label, namefile.png, colors, colors, gradient, corner, boird
imb.NewButtonRec(Panel1,lbn,"android.png",col1,col2,True,1,False)
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim imd As ClassMyDialog
Dim iml As ClassMyLayout
Dim lv As ListView
Dim Button1 As Button
Dim Button2 As Button
Dim Button3 As Button
Dim Button4 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
iml.Initialize
iml.SettingLayout(Activity)
imd.Initialize(Colors.ARGB(255,50,100,150),Colors.Black)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub lv_ItemClick (Position As Int, Value As Object)
imd.DialogClose
End Sub
Sub Button1_Click
Dim bt As Button
bt.Initialize("bt")
bt.Text = "Close"
bt.Gravity = Gravity.CENTER
imd.Dialog01(Activity,"Dialog 1","finestra dialogo semplice",bt)
End Sub
Sub bt_Click
imd.DialogClose
End Sub
Sub Button2_Click
Dim bt1 As Button
bt1.Initialize("bt")
bt1.Text = "Close"
bt1.Gravity = Gravity.CENTER
Dim bt2 As Button
bt2.Initialize("bt")
bt2.Text = "Save"
bt2.Gravity = Gravity.CENTER
imd.Dialog02(Activity,"Dialog 1","finestra dialogo semplice",bt1,bt2)
End Sub
Sub Button3_Click
lv.Initialize("lv")
For i = 0 To 10
lv.AddSingleLine("Line " & i)
Next
Dim title As Label
title.Initialize("")
title.Text = "New dialog"
title.TextSize = 16
title.TextColor = Colors.White
title.Typeface = Typeface.DEFAULT_BOLD
title.Gravity = Gravity.CENTER
imd.Dialog03(Activity,lv)
End Sub
Sub Button4_Click
lv.Initialize("lv")
For i = 0 To 10
lv.AddSingleLine("Line " & i)
Next
Dim title As Label
title.Initialize("")
title.Text = "New dialog"
title.TextSize = 16
title.TextColor = Colors.White
title.Typeface = Typeface.DEFAULT_BOLD
title.Gravity = Gravity.CENTER
imd.Dialog04(Activity,lv,title)
End Sub
Dim title,Message, bt1 As String
title = "test dialog system"
Message = "Questa finestra ha un solo bottone"
bt1 = "Close"
Dim result As Int
result = imd.Dialog01System(Activity,title,Message,bt1)
If result = -1 Then
Else If result = -2 Then
Else
End If
Dim title,Message, bt1, bt2 As String
title = "test dialog system"
Message = "Questa finestra ha due soli bottone"
bt1 = "Save"
bt2 = "Close"
Dim result As Int
result = imd.Dialog02System(Activity,title,Message,bt1,bt2)
If result = -1 Then
Else If result = -2 Then
Else
End If
lv.Initialize("lv")
lv.SingleLineLayout.Label.TextSize = 16
lv.SingleLineLayout.Label.TextColor = Colors.Green
lv.SingleLineLayout.Label.Typeface = Typeface.DEFAULT_BOLD
For i = 0 To 10
lv.AddSingleLine("Line " & i)
Next
Dim title,bt1,bt2,bt3 As String
title = "test dialog system"
bt1 = "Save"
bt2 = "Close"
bt3 = ""
Dim result As Int
result = imd.Dialog03System(Activity,lv,title,bt1,bt2,bt3)
If result = -1 Then
Else If result = -2 Then
Else
End If
Sub Globals
Dim iml As ClassMyLayout
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
iml.Initialize
iml.SettingLayout(Activity)
End Sub
é molto semplice
1) inserisci gli oggetti come Editext, listview ecc ecc dome vuoi poi scrivi nella parte codice quanto segue
B4X:Sub Globals Dim iml As ClassMyLayout End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Main") iml.Initialize iml.SettingLayout(Activity) End Sub
fine, il layout si auto impagina in base allo schermo che trova, non e nulla di così difficile.
Ciao a tutti ecco la libreria che semplifica il tutto per Button, Intent, Sensor, Battery. Un nuovo modo per non scrivere o copiare codice da un progetto all'altro ;-)
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?