How to assign an image to a ListView Item?

1

How to assign an Image to a ListView Item? I want to put an image according to the status of the process. Initially only getting statusbar with external components, but I can not use external. Then I will use an Image according to the status will change the color, because rectangle I could not too. This is what I'm trying to do:

var
  listStatusExame           : TList<TImage>;
  txtStatusExame            : TListItemImage;
begin
  listStatusExame           := TList<TImage>.Create;

  listview1.BeginUpdate;

  for I := 0 to (listview1.Items.Count - 1) do
  begin
    txtStatusExame := TListItemImage(lvwAtendimentos.Items[i].Objects.FindDrawable
      ('status_img'));
    listStatusExame.add(Image1);
    txtStatusExame.ImageSource.ImageList := ImageList1;
  end;
end.

If anyone knows how to add a rectangle to a ListView Item, it would be even better, please.

    
asked by anonymous 07.04.2017 / 20:45

1 answer

1

If I understood your question well, the simplest way would be to bind an ImageList to the ListView and then indicate in the ListView item the index of the image that will be used.

You can change the image at run time.

As I'm running out of time to create an example application I ended up taking a few prints of doing an edit in Paint even to show what I'm talking about.

I hope that helps you.

    
09.05.2017 / 19:26