简体   繁体   中英

Can't scroll listview on Android device Delphi xe7

Can't scroll Listview in Delphi Xe7 on Android device. Some of my listviews can scroll, but not all of them. They all work on iOS.

Here is my code for a problem 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;

UPDATE After messing around and recompiling a few times I've noticed two things:

1) This only happens to Listviews on which the style for the items are set to 'ImageListItemBottomDetail'

2) This issue is not consistent... For example, I have a tab control with two tabs which contain a listview in each tab. Identical Listviews, all except for the name. First time I ran the app, neither would scroll, second time I ran the app ( just closed app and restarted, no changes ) the first Listview scrolled but not the listview on the second tab. restarted app again, this time they both do not work again.

Delphi bug? Issue not apparent on iOS

not sure if this will fix your exact problem in Delphi XE-7 but in my case [delphi-xe10.2.3 Tokyo] took me a while to figure i forgot to [ end list view update] ^^' 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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