Essentially what I want to happen is, after the user scrolls the list, I want the elements to snap into 'grids' instead of remaining where they are, so that I can center the middle component in the list, like in the picture.

enter image description here

I tried manually changing the setSelectedIndex after setting ScrollToSelected to true, but that lacks any animation, and the list scrolls the element to the edge of the screen, rather than the middle.

How can I have the effect of scrolling the element with animation, and to the middle of the screen?

有帮助吗?

解决方案

LWUIT & Codename One both have a snap to grid property in Container and in List. Did you activate it? Just use setSnapToGrid(true) on any component.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top