Android Question Showing B4XListTemplate with 8 items

toby

Well-Known Member
Licensed User
Longtime User
Code: Copy
Dim options As B4XListTemplate
    options.Initialize
    options.Options = Array("Cat", "Dog", "Fish", "Crocodile", "Tiger", "lion", "Kangaroo", "zebra")
    Wait For (Dialog.ShowTemplate(options, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dialog.Show($"You selected: ${options.SelectedItem}"$, "OK", "", "")
    End If
As shown in the attached image, the code snippet above shows first 6 items, and "Kangaroo" and "zebra" are hidden.

I'm looking for at least one of the following two solutions:
  1. Make the list longer to accommodate all 8 items
  2. Add a visual indicator to remind user that there are some more items hidden below.
Thank you in advance for any tips you might give!
 

Attachments

  • longListTemplate.jpg
    longListTemplate.jpg
    103 KB · Views: 670
Solution
It didn't work for me
Try the last post here:

Code: Copy
Dim options As B4XListTemplate
    options.Initialize
    options.Resize(300dip, 600dip)
    options.CustomListView1.AsView.width=300dip
    options.CustomListView1.AsView.Height=600dip
    options.Options = Array("Cat", "Dog", "Fish", "Crocodile", "Tiger", "lion", "Kangaroo", "zebra")
    Wait For (Dialog.ShowTemplate(options, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dialog.Show($"You selected: ${options.SelectedItem}"$, "OK", "", "")
    End If
Thank you very much for trying to help, @Mahares . It didn't work for me, as shown in the attach photo, some extra space was added to the end but the last two items are missing with following line of code added
B4X: Copy
options.Resize(300dip, 600dip)
 

Attachments

  • longListTemplate.mahares.jpg
    longListTemplate.mahares.jpg
    87.4 KB · Views: 526
Upvote 0
It didn't work for me
Try the last post here:

Code: Copy
Dim options As B4XListTemplate
    options.Initialize
    options.Resize(300dip, 600dip)
    options.CustomListView1.AsView.width=300dip
    options.CustomListView1.AsView.Height=600dip
    options.Options = Array("Cat", "Dog", "Fish", "Crocodile", "Tiger", "lion", "Kangaroo", "zebra")
    Wait For (Dialog.ShowTemplate(options, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Dialog.Show($"You selected: ${options.SelectedItem}"$, "OK", "", "")
    End If
 
Last edited:
Upvote 3
Solution
Back
Top