Android Question Views alignment in customlistview


Active Member
Licensed User
Hello, i'm learning to use the customlistview and i don't understand how to aling and place a button in a proper way the result should be something like in the attached image.

Also i cannot find where to change the background color of the customlistview!

I want to align btnask to the right, by setting left as int it will move but is that the correct way?
i don't know exactly how many dips i have in different screens.

Excuse me for so many questions and errors in code.

                        Dim textcontainer As Label

                        Dim btnask As Button
 textcontainer.text = "Name: " &name& " - "&sent_date & CRLF & gender & CRLF & "Age: "&age & CRLF &"Comment: " &comment 
                        listpanel.AddView(btnask,300dip, 2dip, 50dip,50dip)
                        listpanel.AddView(textcontainer,1dip, 2dip, 300dip,300dip)
                        btnask.Width = 40dip
                        btnask.Height = 40dip
                        btnask.SetBackgroundImage(LoadBitmap(File.DirAssets, "askicon.png"))
                        textcontainer.Width = pnlbackground.Width -80
                        userlist.DefaultTextBackgroundColor = Colors.RGB("28","28","28") 'does not works
                        userlist.DefaultTextColor = Colors.Black
                        userlist.Add(listpanel, 90dip,"")

Thank you very much


  • customlistview.jpg
    14.4 KB · Views: 106


Well-Known Member
Licensed User
on the Color question .. in the CLV class Process Globals you have 'RowColor' ..

the following code sets alternative row colors ..
in CLC class Process Globals
rowColor1 = Colors.White
rowColor2 =  0xFFFFF8DC  'Cornsilk
textColor = Colors.Black
rowColorflag = False

Sub  CreateList1(values()As String, width() As Int) As Panel
   'initialize new panel for row
   Dim p As Panel
   'set alternative color
   Select rowColorflag
     Case False
       p.Color = rowColor1     'White
       rowColorflag = True
     Case True
       p.Color = rowColor2    'Cornsilk
       rowColorflag = False
   End Select

note .. just looking at this old code i'm sure theres a way to do that without the rowColorflag boolean.. (another day)
Upvote 0