TlistView从现有项目Android平台更改颜色



我需要一些示例如何从firemonkey中的列表视图中更改每行的颜色文本项目。

我尝试这样的事情,但没有成功。

 for i := 0 to lvArtikli.ItemCount-1 do
        begin
          AItem := lvArtikli.Items.AppearanceItem[i];
          pk := AItem.Data['txtPK'].AsString;
          if pk = '' then
          begin
             //change color
            TListItemText(AItem.Objects.FindDrawable('txtPK')).TextColor := TAlphaColorRec.Red;
          end;
  end;

为了为某个列着色,对于每一行,都必须将以下代码放在Event onupdateObject上。

procedure TfrmMeni.lvKorektivnoUpdateObjects(const Sender: TObject;const AItem: TListViewItem);
begin
TListItemText(AItem.Objects.FindDrawable('txtPK') as TListItemText).TextColor:= TAlphaColorRec.Gold;
end;

最新更新