问题
The FloatingButton seems to be added only in Form.getContentPane() and cannot be added to a container Adding it to my form would make the button shield some components underneaths,
Any solution to this? I would like to have positioned inside the scrolling table in a BorderLayout.CENTER
not much options here:
fab.bindFabToContainer(current, Component.RIGHT, Component.CENTER);
回答1:
fab.bindFabToContainer(current, Component.RIGHT, Component.CENTER);
Doesn't add the fab to a container. It creates a new container and returns it so the right statement would be:
current = fab.bindFabToContainer(current, Component.RIGHT, Component.CENTER);
myForm.add(current);
Since the fab needs to float on top and we don't want to change your existing layout we create a new wrapper container with layered layout.
Notice that in the form/content page we can use the existing form layered layout (plus the content pane can't be replaced) so we detect that and use a special case with the layered pane.
来源:https://stackoverflow.com/questions/63763608/how-can-i-reposition-the-floating-button-in-codenameone