LWUIT(J2ME) List snapping elements to grid after scrolling

125 views Asked by At

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?

1

There are 1 answers

3
Shai Almog On BEST ANSWER

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.