Android Question Showing B4XListTemplate with 8 items

toby

Well-Known Member
Licensed User
Longtime User
ListTemplate shows 6 of 8 items.:
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
    103 KB · Views: 323
Solution
It didn't work for me
Try the last post here:

B4X:
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

Mahares

Expert
Licensed User
Longtime User
Make the list longer to accommodate all 8 items
Did you try to resize it:
B4X:
B4XListTemplate1.Resize(500dip, 600dip)
In your case:
B4X:
Dim options As B4XListTemplate
    options.Initialize
    options.Resize(300dip, 600dip)
 
Last edited:
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
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:
options.Resize(300dip, 600dip)
 

Attachments

  • longListTemplate.mahares.jpg
    87.4 KB · Views: 220
Upvote 0

Mahares

Expert
Licensed User
Longtime User
It didn't work for me
Try the last post here:

B4X:
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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…