Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8088565

ListView.scrollTo does not center on index




      When invoking ListView.scrollTo on a ListView containing 200 country names, the list does not center perfectly on the index chosen. My ListView is rendered large enough to display 9 items at the same time. I would expect that if I invoke scrollTo(25), then the 25th item would be placed dead center in the ListView, meaning what I would see was something like this

      list item 21
      list item 22
      list item 23
      list item 24
      list item 25 (in center)
      list item 26
      list item 27
      list item 28
      list item 29

      This does not work as expected though. The higher the index I scrollTo the more the centering drifts off to the bottom of the list. For instance, if I invoke scrollTo(175) I get something like

      list item 168
      list item 169
      list item 170
      list item 171
      list item 172
      list item 173
      list item 174
      list item 175 (should have been centered)
      list item 176

      Although this is not critical it sure is not optimal either. In some extreme cases the element which should have been placed at the center is placed so far down, only the top of its letters are visible in the list view.

      Has ListView.scrollTo ever been tested with a large number of items (say 200+)? If not, I think some more testing here would be appropriate.




            Unassigned Unassigned
            risaksen Randahl Isaksen
            3 Vote for this issue
            4 Start watching this issue