如何将“删除”按钮的高度设置为所有设备(手机,平板电脑)的容器swipeC的高度,因为容器的大小不同。请参阅随附的代码。
代码:
Container cc = new Container(BoxLayout.y());
cc.add(BorderLayout.center(type).add(BorderLayout.EAST, b));
cc.add(BorderLayout.center(start).add(BorderLayout.EAST, endTime));
MultiButton delete = new MultiButton();
delete.setTextLine1("");
Style s = UIManager.getInstance().getComponentStyle("Button");
**FontImage.setMaterialIcon(delete, FontImage.MATERIAL_DELETE, 12f);**
FontImage p = FontImage.createMaterial(FontImage.MATERIAL_PORTRAIT, s);
Container leftSwipeCont = new Container();
leftSwipeCont.add(delete);
SwipeableContainer swipeC = new SwipeableContainer(null,
BorderLayout.center(leftSwipeCont), cc);
swipeC.getAllStyles().setBorder(Border.createBevelRaised());
activities.add(BoxLayout.encloseY(swipeC));
答案 0 :(得分:0)
尝试使用ScaleImageButton
代替MultiButton
。由于setMaterialIcon()
无法使用此类按钮,因此您需要生成一个图标并手动设置。