iOS Question Masonry View

narek adonts

Well-Known Member
Licensed User
Longtime User
Great piece of Code !
 
Upvote 0

narek adonts

Well-Known Member
Licensed User
Longtime User
Modified your code a little bit to be able to change the number of Columns by parameter.

B4X:
Public Sub Masonry(Columns As Int)
    Dim arr(Columns) As Int
    Dim top As Int
    For i = 0 To 100
        Dim pnl As Panel
        pnl.initialize("")
        pnl.Color=Colors.RGB(Rnd(0,255),Rnd(0,255),Rnd(0,255))
        scv.panel.addview(pnl,(100%x/arr.Length) *(i Mod arr.Length),arr( i Mod arr.Length),100%x/arr.Length,Rnd(50dip,200dip))
        arr(i Mod arr.Length) = arr(i Mod arr.Length) + pnl.Height + 8dip 'padding
    Next
   
    Dim l As List
    l.Initialize2(arr)
    l.Sort(True)
    scv.ContentHeight = l.Get(l.Size-1)
End Sub
 
Upvote 0

ykucuk

Well-Known Member
Licensed User
Longtime User

Hello narek,

Thank you. your code works very well. I would like to ask how can i modify this code for add more records to current masonry. For example users ll click to "more button" for add 10 more records. I tried but unfortunately i didn't succeed. Added 10 records seems not like should be.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…