Android Question How to set text color in a CustomView?

Massy

Member
Licensed User
Longtime User
Hello, I'm using a CustomView with AutoTextSizeLabel, I would like to change the text color by code, but I don't know how to do it... I saw in the tread for AutoTextSizeLabel Erel said to someone that asked the same thing to change its tipe to Public, I did it but nothing changed and CustomView1.color = Colors.Red keep giving an error...
How can I do it?
Thanks for your help
Massy
 

stevel05

Expert
Licensed User
Longtime User
You need to change the text color for each child (label or AutoTextSizeLabel) or whatever you have in the custom listview. If this doesn't help post the code that you are using to create the CustomListView, it will make it easier to help.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Sorry I misread the question, I thought you were asking about a CustomListView.

To change the color of the label in the AutoTextSizeLabel you need to access the label it contains. You can add this sub to the AutoTextsizeLabel Class and it will change the color:

B4X:
Public Sub setTextColor(color As Int)
    mLbl.TextColor = color
End Sub
 
Upvote 0
Top