Tuesday, October 18, 2011

LWUIT scrolling problem

LWUIT scrolling works most of the times, however, I had problems with scrolling in a view like this:

I had some non-focusable multiline text area at the bottom of the screen and pressing down when focus is on cancel button did not scroll it.

There may be a better fix, but my quick (and dirty) fix was that, I added a focusable invisible item at the bottom !


    this.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    Component invisibleItem = createInvisibleItem();

    this.addComponent(input1);
    this.addComponent(input2);
    this.addComponent(buttonOk);
    this.addComponent(buttonCancel);
    this.addComponent(textAreaLong);
this.addComponent(invisibleItem); buttonCancel.setNextFocusDown(invisibleItem); } private void createInvisibleItem() { Component component = new Container(); component.setNextFocusDown(component); //to protect any jump }

No comments:

Post a Comment