Android中的浮動操作按鈕是不錯的選擇。我想在我的codenameone應用程序中。我已經通過使用LayeredLayout嘗試了兩種佈局。我無法完美實現它。該按鈕隨着滾動繼續移動。如何將按鈕固定在屏幕的右下方,而不會影響背景圖層何時滾動。如何在Codenameone中實現浮動操作按鈕?
這是我的嘗試。
Form myForm = new Form();
myForm.setLayout(new LayeredLayout());
myForm.setTitle("Floating Action Button");
SpanLabel lbl = new SpanLabel("some long text");
Container conBottom = new Container();
conBottom.setLayout(new BoxLayout(BoxLayout.Y_AXIS));
conBottom.addComponent(lbl);
FlowLayout flow = new FlowLayout(Component.RIGHT);
flow.setValign(Component.BOTTOM);
Container conUpper = new Container(flow);
conUpper.addComponent(new Button("+"));
conUpper.setScrollable(false);
myForm.addComponent(conBottom);
myForm.addComponent(conUpper);
myForm.show();
這裏是類似於我想要實現的鏈接。 https://github.com/Clans/FloatingActionButton 請幫忙! 謝謝!