How to insert images to TImagelist in FireMonkey programmaticaly?

  

I try to populate TListView

Current code

MyList.Items.Clear;
for I := 0 to List.Count-1 do
begin
Item:= MyList.Items.Add;
Item.Text:= List[i];

si:=ImageList.Source.Add;
src:=’https://pixabay.com/static/uploads/photo/2015/10/01/21/39/background-image-967820_960_720.jpg’;
ms:=LoadWebImage(src);
si. MultiResBitmap.LoadItemFromStream( ms,100);

Item.ImageIndex := i;

end;

Images loaded without errors

function LoadWebImage(url: string) : TMemoryStream;
var
idhttp : TIdHTTP;
begin
IdHTTP := TIdHTTP.Create(nil);
Result := TMemoryStream.Create;
try
idhttp.Get (url, Result);
Result.Position := 0;
finally
idhttp.Free;
end;
end;

In result i see only text and one image when i added manually for test

ItemAppeariance set as ImageListItem

Comments are closed.