Skip to content

Android (Samsung) Navigation bar is overlapping Containers when setSafeArea(true) is applied. #3937

@JNorth83

Description

@JNorth83

Describe the bug
Affecting Android (Samsung) devices that use virtual buttons in the Navigation bar. setSafeArea(true) is not applying correctly to containers which causes the Navigation bar to overlay the container. If .setSafeArea(true) is applied to the whole form then this doesn't happen

To Reproduce
Scrollable form with enough content to scroll.
Applying safe area to just containers causes the issue

Test Case
Form form = new Form("Blank Page", new BorderLayout());

    Container northcnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    Container centercnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    centercnt.setScrollableY(true);

    Button b_north = new Button("North");

    FloatingActionButton fab = FloatingActionButton.createFAB(FontImage.MATERIAL_ADD);
    fab.addActionListener(e -> {

    });
    fab.bindFabToContainer(form.getContentPane(), Component.RIGHT, Component.BOTTOM);

    northcnt.add(b_north);
    // Add 50 test buttons
    for (int i = 1; i <= 50; i++) {
        Button b_test = new Button("Test Button " + i);
        centercnt.add(b_test);
    }

    northcnt.setSafeArea(true);
    centercnt.setSafeArea(true);

    form.add(BorderLayout.NORTH, northcnt).add(BorderLayout.CENTER, centercnt);
    form.show();

Expected behaviour
For the navigation bar not o to overlap containers and FAB when the setSafeArea(true) is applied.

Screenshots

Safe Area applied to Containers

Image

Smartphone (please complete the following information):

  • Device: Galaxy Samsung S21 Ultra & Galaxy Samsung S24
  • OS: Andoroid 15

Additional context
Applying safe area to the form causes issues with space around the iPhone's notch/display cut out for the camera, so I'd rather avoid doing that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions