繁体   English   中英

无法在Android设备Delphi XE7上滚动ListView

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM