How to determine the size of an item within a list

12 views
Skip to first unread message

rdvg...@gmail.com

unread,
Sep 3, 2018, 2:27:38 AM9/3/18
to CodenameOne Discussions
Hello,

I was forced to copy the autoCompleteTextField component and create a version that suits my needs. Everything is turning out quite well, just that within this class there is the "calcPopuupHeight" method that uses the following instruction to return the size of the popup window:

int listHeight = items * l.getElementSize (false, true) .getHeight ();

In the List component I have not found anything that returns the size of the elements.

Thank you for your support

Shai Almog

unread,
Sep 4, 2018, 1:49:01 AM9/4/18
to CodenameOne Discussions
Hi,
I would strongly suggest avoiding list see https://www.codenameone.com/blog/avoiding-lists.html there is really no reason to use them. I would use a search field with a toolbar as demonstrated here https://www.codenameone.com/javadoc/com/codename1/ui/Toolbar.html

The item height is calculated based on a prototype object so you need to set the prototype object to the list. Notice all items in the list have the same height that can't be changed...
Reply all
Reply to author
Forward
0 new messages