Hi everyone,
I try to create togglebuttons with two différent bitmaps programmatically but nothing appears in my view, can someone tell me what is wrong in this code ?
Many Thanks
I try to create togglebuttons with two différent bitmaps programmatically but nothing appears in my view, can someone tell me what is wrong in this code ?
Many Thanks
B4X:
Sub Globals
Private lblTitre1 As Label
Dim btOK1, btQuit1 As Button
Dim btn(12) As ToggleButton 'boutons des quilles
Dim bdwOn, bdwOff As BitmapDrawable 'images des boutons quilles
Dim sld As StateListDrawable 'Définir les différents états des boutons quilles
Dim BlEtatBouton As Boolean 'boulléen état d'un bouton quilles
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("loTour")
'Initialisation des labels
lblTitre1.Initialize("")
lblTitre1.Text = "MY TITLE"
'Initialisation des boutons d'action
btQuit1.Text = "Quitter"
btOK1.Text = "OK"
'Initialisation des boutons quilles
sld.Initialize
Dim i As Int
For i = 0 To 11
btn(i).Initialize("Quille")
btn(i).Tag = i
bdwOn.Initialize(LoadBitmap(File.DirAssets, "Quille_12_Croix.png"))
bdwOff.Initialize(LoadBitmap(File.DirAssets, "Quille_12.png"))
btn(i).Background=sld
'Initialiser le bouton sans texte dessus et par défaut en position off
btn(i).TextOff = ""
btn(i).TextOn = ""
btn(i).Checked = False
'Ajouter le bouton à la vue
Activity.AddView(btn(i), 0%x, i * 30Dip, 15%x, 20Dip)
BlEtatBouton = btn(i).Checked
Next