[英]Can't scroll listview on Android device Delphi xe7
無法在Android設備上的Delphi Xe7中滾動Listview。 我的某些列表視圖可以滾動,但不能全部滾動。 它們都可以在iOS上使用。
這是我的問題ListView的代碼
if AResult=true then
begin
AccessList.BeginUpdate;
try
XMLDocument.LoadFromXML(XMLData);
XMLNode:=XMLDocument.DocumentElement.ChildNodes['Record'];
while XMLNode<>nil do
begin
LItem:=AccessList.Items.Add;
LItem.Text:=XMLNode.ChildNodes['NAME'].Text;
LItem.Detail:=XMLNode.ChildNodes['US1_LOGIN'].Text;
if LItem.Detail='' then
begin
LItem.Detail:='Mobile Access not setup';
LItem.Objects.DetailObject.TextColor:=TAlphaColors.Crimson;
LItem.Objects.DetailObject.Font.Size:=9.5;
end;
LItem.Tag:=StrToInt(XMLNode.ChildNodes['ID_Nr'].Text);
if XMLNode.ChildNodes['US1_DELETED'].Text='0' then
LItem.Objects.AccessoryObject.Visible:=true
else
LItem.Objects.AccessoryObject.Visible:=false;
XMLNode:=XMLNode.NextSibling;
end;
finally
AccessList.EndUpdate;
toggleBusy(false);
end;
end;
更新在弄亂並重新編譯幾次之后,我注意到了兩件事:
1)僅在將項目樣式設置為“ ImageListItemBottomDetail”的Listview上發生
2)這個問題不一致。例如,我有一個帶有兩個選項卡的選項卡控件,每個選項卡中都包含一個列表視圖。 相同的Listviews,除了名稱以外的所有視圖。 第一次運行該應用程序時,不會滾動,第二次運行該應用程序(僅關閉應用程序並重新啟動,沒有更改),第一個Listview滾動了,但第二個選項卡上的listview卻沒有滾動。 重新啟動了應用程序,這一次它們都不再起作用。
德爾福漏洞? 問題在iOS上不明顯
不知道這是否可以解決您在Delphi XE-7中的確切問題,但是在我的情況下,[delphi-xe10.2.3 Tokyo]花了我一段時間才使我忘記了[結束列表視圖更新] ^^'Form1.ListView1.EndUpdate; <-
Form1.ListView1.BeginUpdate;
try
begin
LVI:= Form1.ListView1.items.add;
LVI.Text := sCH.Strings[1];
end;
except
end;
Form1.ListView1.EndUpdate; // this part is important scroll will not work without it .. in my case.
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.