1

当滚动框上的填充 TListview 离开屏幕并返回时,这里有什么方法可以避免在 Android 上滞后?看起来它试图在出现在屏幕上之前重新填充列表中的所有项目。

示例代码:ScrollBox1 - allaligned 'Client', ListView1 on ScrollBox1, Button1 on ScrollBox1;

procedure TForm1.FormCreate(Sender: TObject);
var
  LItem: TListViewItem;
  I: Integer;
begin
  //just...
  ListView1.Height := ListView1.ItemAppearance.ItemHeight;
  ListView1.Position.X := 0;
  ListView1.Position.Y := 0;

  // To achieve the best performance use BeginUpdate and EndUpdate.
  ListView1.BeginUpdate;
  try
    for I := 1 to 3000 do
    begin
      LItem := ListView1.Items.Add;
      LItem.Text := IntToStr(I);
    end;
  finally
    ListView1.EndUpdate;
  end;

  //expand form
  Button1.Position.X := 1000;
  Button1.Position.Y := 1000;
end;
4

0 回答 0