我正在尝试更改listviewitem中文本颜色的文本颜色。我在listviewitem中有多个文本对象。我正在使用以下代码
Litem := ListView1.Items.Add;
Litem.Data['ytde'] := currtostrf(ytde,ffCurrency,2);
Litem.Data['ytdbe'] := currtostrf(ytdbe,ffCurrency,2);
Litem.Data['ytdetotal'] := currtostrf(ytdetotal,ffCurrency,2);
Litem.Objects.TextObject.TextColor := TAlphaColorRec.Green
调试时出现错误说无法访问的对象,但是当我执行以下操作时,我没有问题更改颜色
LItemheader.Purpose := TListItemPurpose.Header;
Litemheader.Objects.TextObject.TextColor := TAlphaColorRec.blue;
任何想法?
答案 0 :(得分:5)
找到答案:
TListItemText(Litem.Objects.FindDrawable('ytde')).TextColor := TAlphaColorRec.Red;