Hello,
I have created the button dynamically. But not able to control the width and height of the button at customListView.
Below is my code snippet
Please suggest
I have created the button dynamically. But not able to control the width and height of the button at customListView.
Below is my code snippet
B4X:
Sub Process_Globals
Dim xui As XUI
End Sub
Sub Globals
Private CLV1 As CustomListView
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Main")
'CLV1.DefaultTextBackgroundColor=Colors.Gray
For i = 0 To 100
CLV1.Add(createItem("Item #" & i,CLV1.AsView.Width,200dip),i)
Next
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
private Sub createItem(Text As String,width As Int,height As Int) As B4XView
Dim p As B4XView=xui.CreatePanel("")
Dim btnxpan As Button
btnxpan.Initialize("")
p.SetLayoutAnimated(0,0,0,100%x,10%x)
p.Color=Colors.White
Dim lbl As Label
lbl.Initialize("")
lbl.Text=Text
lbl.TextColor=Colors.Black
p.AddView(lbl,12dip,10dip,100dip,100dip)
btnxpan.Color=Colors.Gray
btnxpan.TextColor=Colors.Black
btnxpan.Width=70%x
btnxpan.Text=Text
p.AddView(btnxpan,90%x,10dip,10dip,10dip)
Return p
End Sub
Please suggest