2
我尝试过手风琴,它不会在模拟器和设备中顺利扩展和合同。相反,它会突然展开和收缩。手风琴不能正常工作
请看看视频here。
怎么会有2个滚动条(在视频的最后你会看到2个滚动条,内部滚动条会滚动,最外面的会保持静态)最右边的屏幕上会出现一条额外的黑色线条。
public final class LabourCategory extends Form {
public LabourCategory(Resources res) {
super(new BoxLayout(BoxLayout.Y_AXIS));
setTitle("Labour Category");
loadComponent(res);
revalidate();
}
public void loadComponent(Resources res) {
Container mainContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
mainContainer.setUIID("small");
mainContainer.getAllStyles().setBgColor(0xcccccc);
mainContainer.getAllStyles().setBgTransparency(255);
mainContainer.getAllStyles().setMarginLeft(3);
add(mainContainer);
for (int i = 0; i < 10; i++) {
Accordion labourCategory = new Accordion();
labourCategory.addContent("Labour Category " + i,BoxLayout.encloseY(new Label("aaa"),new Label("bbb"), new Label("ccc")));
labourCategory.setUIID("small");
labourCategory.getAllStyles().setBgColor(0xffffff);
labourCategory.getAllStyles().setBgTransparency(255);
mainContainer.add(labourCategory);
}
}
}
谢谢钻石。然后它需要borderlayout才能工作。而关于多个滚动条,如果它是手风琴,我很困惑。如果在设备屏幕内看到手风琴,则只有一个滚动条,但一旦超过设备高度,就会出现两个令人讨厌的滚动条。我如何手动移除手风琴滚动条? – beck
您可以调用'mainContainer.setScrollVisible(false);'和'getContentPane()。setScrollVisible(false);'在包装容器和窗体上隐藏滚动条。 – Diamond
这就是我通过手动删除的意思。 – Diamond