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