#Region Project Attributes
#ApplicationLabel: listviewex
#VersionCode: 1
#VersionName: 1.0
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: true
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: false
#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 panlist As Panel
Dim scrolllista As ScrollView
Dim labtitle As Label
Dim item As Int
Dim prova 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")
Activity.LoadLayout("main")
panlist.SetLayout(0%x, 0%y, 100%x, 100%y)'with the visible property, managed the panel
labtitle.SetLayout(0%x, 5%y, 100%x, 10%y)
scrolllista.Initialize(500)
panlist.AddView(scrolllista,0%x,16%y,100%x,84%y)
prova.Initialize("prova")
prova.Text="Pulsante"
crealista
End Sub
Sub crealista
'scrolllista.Panel.RemoveAllViews ' Write this line if you have many text files and one scrolview. Clear Previous List
Dim Bitmap1 As Bitmap
Dim Panel0 As Panel
Dim PanelTop, PanelHeight As Int
Dim lista As List
lista=File.ReadList(File.DirAssets,"listlabel.txt")
Bitmap1.Initialize(File.DirAssets,"banner1.png") ' First image of list
PanelTop=1%y
Panel0=scrolllista.Panel
Panel0.Color=Colors.argb(0,0,0,0) 'sets the invisible panel
For i=0 To lista.Size-1
If i>0 AND i<3 Then Bitmap1.Initialize(File.DirAssets,"banner.png") 'Images beyond the first. Only if you use 2 images and 2 label
Dim ImageView1 As ImageView
ImageView1.Initialize("View")
PanelHeight=12%y
Panel0.AddView(ImageView1,5%x,PanelTop,90%x,PanelHeight)
ImageView1.Tag=i&"1"
ImageView1.Bitmap=Bitmap1
ImageView1.Gravity=Gravity.fill
Dim Label1, Label2 As Label
Label1.Initialize("")
Label2.Initialize("")
Panel0.AddView(Label1,5%x,PanelTop-2%y,90%x,PanelHeight)
Panel0.AddView(Label2,5%x,PanelTop+2%y,90%x,PanelHeight)
Label1.TextColor= Colors.black
Label1.TextSize= 17
Label1.Gravity=Gravity.CENTER
Label1.Color=Colors.argb(0,0,0,0)
Label1.Text=lista.Get(i)
Label2.TextColor= Colors.black
Label2.TextSize= 15
Label2.Gravity=Gravity.CENTER
Label2.Color=Colors.argb(0,0,0,0)
Label2.Text=lista.Get(i+1)
i=i+1
If i > lista.size-1 Then i = lista.size-1
PanelTop=PanelTop+PanelHeight
Next
Panel0.AddView(prova,20%x,PanelTop+2%y,60%x,10%Y)
Panel0.Height=PanelTop+14%y
End Sub
Sub View_Click
Dim Send As View
Dim row As Int
Send=Sender
row=Floor(Send.Tag/20)
item=row
labtitle.Text="Item "&item
End Sub
Sub prova_Click
labtitle.Text="pulsante"
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub