ListView Question

BMA498

New Member
Licensed User
Longtime User
I have a quick question about ListView, is it possible to change the background or font color of a specific item? If not what would you suggest to use? I have read a bit about scroll view and am not sure still how I would go about changing a specific item.

Thanks all
 

derez

Expert
Licensed User
Longtime User
The way to do it is to define two types of items - SingleLineLayout and TwoLinesLayout, and set the specific properties of the disply of each (beckground, font etc.)
When setting the values to the list - add all as SingleLineLayout except the specific which adds as TwoLinesLayout.
Here is an example from one of my applications:
B4X:
topic_list.singlelineLayout.ItemHeight = 15%y
topic_list.SingleLineLayout.Background = topdr
topic_list.singleLineLayout.Label.TextColor = Colors.white
topic_list.SingleLineLayout.Label.TextSize = fontsize
topic_list.SingleLineLayout.Label.Gravity = Gravity.CENTER_HORIZONTAL

topic_list.TwoLinesLayout.Label.Gravity = Gravity.CENTER_HORIZONTAL
topic_list.TwoLinesLayout.SecondLabel.RemoveView
topic_list.TwoLinesLayout.Label.Left = 0
topic_list.TwoLinesLayout.ItemHeight = topic_list.singlelineLayout.ItemHeight
topic_list.TwoLinesLayout.Label.Height = topic_list.singlelineLayout.Label.Height
topic_list.TwoLinesLayout.Label.TextSize = topic_list.singlelineLayout.Label.textsize
topic_list.TwoLinesLayout.Label.SetBackgroundImage(LoadBitmap(File.DirAssets,"yellow.png"))
topic_list.TwoLinesLayout.Label.TextColor = Colors.black
topic_list.Visible = True
 
Upvote 0
Top