Hi all,
I'm trying to find a way to set the SingleLineLayout.ItemHeight of a ListView according to the values of a List, but I have some problem.
Here's a sample code:
B4X:
Sub ShowData(position as Int)
Dim su As StringUtils
Dim ll As Label
Dim i As Int
ListViewData.Clear
ListViewData.AddSingleLine(NewData.Get(position))
ll = ListViewData.SingleLineLayout.Label
ll.TextSize = ListViewData.SingleLineLayout.Label.TextSize
ll.Width = ListViewData.Width
ListViewData.SingleLineLayout.ItemHeight = su.MeasureMultilineTextHeight(ll, NewData.Get(posizione))
End Sub
NewData is a List populated reading values from a sqlite db. First time ShowData is called the set of ItemHeight is correct, but then this first set is always used for every next call.
su.MeasureMultilineTextHeight(ll, NewData.Get(posizione)) always return the correct value, but ListViewData.SingleLineLayout.ItemHeight is no more set.
Why? What I'm doing wrong?
Thanks Erel. I've added the class to my project and created the CustomListView I need, but I notice that some properties (Visible, Top, Left, Height) are not available to code. Compiling I obtain the "Unknown member" error.
How can I do? I need to modify them by code depending of what the user do.