TListView change color from existing item android platform

312 views Asked by At

I need some example how to change color text item for each row from my list view in FireMonkey.

I try something like this but unsuccessfully.

 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;
1

There are 1 answers

0
Jande On BEST ANSWER

In order to color a certain column, and for each row it is necessary to put the following code on event onUpdateObjects.

procedure TfrmMeni.lvKorektivnoUpdateObjects(const Sender: TObject;const AItem: TListViewItem);
begin

TListItemText(AItem.Objects.FindDrawable('txtPK') as TListItemText).TextColor:= TAlphaColorRec.Gold;

end;