Android Question CustomListView - background on item

Giusy

Active Member
Licensed User
Hi,
my question is this:
Is it possible to change, in CustomListView, the background or color of the text, on a single item?
Thank you
 

mangojack

Well-Known Member
Licensed User
It is not that difficult .. At time of loading the CLV you can set the Background / Text Color properties of the Label / EditText for a single Item/Row
depending on a certain condition.

Or .. maybe on Row click access the row item panel / views to change the properties.

The following uses a Button click as found in the xCustomListView example Here ....
B4X:
Sub Button1_Click
    Dim index As Int = clv2.GetItemFromView(Sender)
    Dim pnl As B4XView = clv2.GetPanel(index)
    Dim lbl As B4XView = pnl.GetView(0)     'the first view within panel
    lbl.Color = Colors.Blue
    lbl.TextColor = Colors.Yellow
End Sub
 

Giusy

Active Member
Licensed User
It is not that difficult .. At time of loading the CLV you can set the Background / Text Color properties of the Label / EditText for a single Item/Row
depending on a certain condition.

Or .. maybe on Row click access the row item panel / views to change the properties.

The following uses a Button click as found in the xCustomListView example Here ....
B4X:
Sub Button1_Click
    Dim index As Int = clv2.GetItemFromView(Sender)
    Dim pnl As B4XView = clv2.GetPanel(index)
    Dim lbl As B4XView = pnl.GetView(0)     'the first view within panel
    lbl.Color = Colors.Blue
    lbl.TextColor = Colors.Yellow
End Sub
Hi @mangojack ,
it work very well, thank you :D
 
Top