문제

I've created an apps using LWUIT. It use the header bar, like this

enter image description here

It use the container. Under this header bar container I've created the scroll able list.

The strange part is, if I scroll this list, the color of the button (the menu button and filter button) in header bar changed. And it just happened when I tried the apps in device. When I try using it in emulator it just fine

Here is the code of the button I've created

    b_menu.getUnselectedStyle().setBorder(null);
    b_menu.getSelectedStyle().setBorder(null);
    b_menu.getPressedStyle().setBorder(null);
    b_menu.setIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setRolloverIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setPressedIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setName("menu");
    b_menu.getStyle().setBgTransparency(0);
    b_menu.getStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getSelectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getUnselectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getSelectedStyle().setBgColor(0xcf266a, false);
    b_menu.getSelectedStyle().setBgTransparency(0);
    b_menu.getSelectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getUnselectedStyle().setBgTransparency(0);
    b_menu.getUnselectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getPressedStyle().setBgTransparency(0);
    b_menu.getPressedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

Have you ever met and solve this problem?

Regards

Giri

도움이 되었습니까?

해결책

Oh, the answer is I also have to change the unselected style. Here the code

    b_menu.getUnselectedStyle().setBorder(null);
    b_menu.getSelectedStyle().setBorder(null);
    b_menu.getPressedStyle().setBorder(null);

    b_menu.setIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setRolloverIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setPressedIcon(ImageUtil.loadImage("/menu.png"));

    b_menu.setName("menu");

    b_menu.getStyle().setBgTransparency(0);
    b_menu.getStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getSelectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getSelectedStyle().setBgTransparency(0);
    b_menu.getSelectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getUnselectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getUnselectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getUnselectedStyle().setBgTransparency(0);
    b_menu.getUnselectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getPressedStyle().setBgTransparency(0);
    b_menu.getPressedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.addActionListener(this);
    b_menu.repaint();

Thanks for viewing this question!

Regards

Giri

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top