iOS Question iCustomListView vs xCustomListView vs class CustomListView

Cadenzo

Active Member
Licensed User
Longtime User
Starting to bring some of my B4a projects to B4i, I used the iCustomListView lib. It works, but the recommendation is, to use the newer xCustomListView or the CustomListView class.

Now I use the class CustomListView. It works also perfect, but I have some questions, just for the understanding:
Lib: version 1.64
Class: https://www.b4x.com/android/forum/threads/class-customlistview.46560/#content

What is prefered for new projects? What is updated more often?
Why has the Class (and also the old iCustomListView Lib) the ItemHigh-Parameter in Add-methode, but the xCustomListView has not?
 

Cadenzo

Active Member
Licensed User
Longtime User
The height is being determined from the panel's height.
This is also, why it did not work for me in the beginning. With xCustomListView it is important to define the Panel.Height! In the other variants it is not, because it is defined by the ItemHeight parameter in Add methode.
B4X:
clvContent.Add(CreateListItem(lstGameBitmaps.Get(0),"Westernpiano", "",  "",  0), "game1") 'Panel and Value

Sub CreateListItem(btm As Bitmap, header As String, info As String, footer As String, score As Int) As Panel
    Dim p As B4XView = xui.CreatePanel("") 'Dim p As Panel
    p.SetLayoutAnimated(0, 0, 0, clvContent.AsView.Width, 200dip)
    p.LoadLayout("viewItemGame")
    imgItemTyp.SetBitmap(btm)
    lblItemHeader.Text = header
    lblItemInfo.Text = info
    lblItemFooter.Text = footer
    lblScore.Text = score
    Return p
End Sub
Now it works also with xCustomListView. Thanks!
 
Last edited:
Upvote 0

Cadenzo

Active Member
Licensed User
Longtime User
OK, my main mistake was: I took my old code from b4a, than I saw that the panel in b4i has no .SetLayout methode and I just removed that line of b4a code in b4i. Then it worked for me somehow, because the itemHeight was set in the Add methode. I think, now is everything clear. Use B4XView instead of panel, set the size with SetLayout, then load the layout. I corrected my code in #4. Thangs again!
 
Upvote 0
Top