I am loading a cutsomlistview as per the code below. If I don't include images its quiet fast, but as soon as I add vehicle manufacturer logos it really slows down.
Is there a better way to display a list of vehicle manufacturers and there logos?
I have included a sample logo. They are all aroung 6kb or less in size.
List is about 75 rows longs.
Is there a better way to display a list of vehicle manufacturers and there logos?
I have included a sample logo. They are all aroung 6kb or less in size.
List is about 75 rows longs.
B4X:
ub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("VehiclesLayout")
vehiclesLV.SingleLineLayout.Label.TextSize = 18
vehiclesLV.Color = Colors.White
vehiclesLV.SingleLineLayout.Label.TextColor = Colors.Black
vehiclesLV.SingleLineLayout.Label.Gravity = Gravity.CENTER_HORIZONTAL
vehiclesCLV.Initialize(Me, "vehiclesCLV")
vehiclesPanel.AddView(vehiclesCLV.AsView, 0, 0, LVJump.Left, LVJump.Height)
vehiclesCLV.DefaultTextBackgroundColor = Colors.DarkGray
Main.CursMake = Main.sql1.ExecQuery("SELECT * FROM VehicleMakes WHERE EXISTS (Select 1 FROM Vehicles WHERE Vehicles.MakeID = VehicleMakes.MakeID) ORDER BY MakeName")
If Main.CursMake.RowCount > 0 Then
Dim tempMake As String
For i = 0 To Main.CursMake.RowCount -1
Main.CursMake.Position = i
tempMake = Main.CursMake.GetString("MakeName")
vehiclesCLV.Add(createListItem(tempMake), 62dip, "Item #t" )
Next
End If
End Sub
Sub createListItem (Make As String) As Panel
Dim p As Panel
p.Initialize("")
p.Color = Colors.RGB(151,179,207)
Dim iv1 As ImageView
If File.Exists(File.DirAssets, Make & ".png") Then
iv1.Initialize("iv1")
iv1.Bitmap = LoadBitmap(File.DirAssets, Make & ".png")
End If
Dim b1 As Button
b1.Initialize("Mbutton") 'all buttons click events will be handled with Sub Button_Click
b1.Text = Make
If iv1.IsInitialized Then
p.AddView(iv1, 5dip, 0dip, 60dip, 60dip)
End If
p.AddView(b1, 75dip, 0dip, (vehiclesPanel.Width - LVJump.Width)- 80dip, 60dip) 'view #0
'If File.Exists(File.DirAssets, Make & ".png") Then
'End If
Return p
End Sub