Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to get correct content rect on Android #2931

Open
NiklasEi opened this issue Jul 8, 2023 · 2 comments
Open

Failing to get correct content rect on Android #2931

NiklasEi opened this issue Jul 8, 2023 · 2 comments

Comments

@NiklasEi
Copy link

NiklasEi commented Jul 8, 2023

I am working on an Android app using Bevy and am having trouble getting the are of the screen that I can render my app in. My phone has a camera cutout on top and soft buttons in the bottom area of the screen.

The area of the soft buttons is correctly given by (inner_size.height as f32 - content_rect.bottom as f32) / scale_factor as f32, but the top area is consistently reported as too big. One way to see this is to remove the WindowManagerFlags::LAYOUT_IN_SCREEN flag, which completely removes the possibility to render behind the camera/info bar. But content_rect still tells me I need to keep 56px on top empty (content Rect { left: 0, top: 147, right: 1080, bottom: 2047 } and scale 2.625). An even bigger distance from top gets reported when I change from portrait to landscape mode.

The following shows two buttons rendered according to the reported content rect at the top most and bottom most positions (I am ignoring left/right for now).

Screen_Recording_20230708-125921.mp4
@mockersf
Copy link
Contributor

mockersf commented Jul 8, 2023

related to #2308

@NiklasEi
Copy link
Author

NiklasEi commented Jul 9, 2023

Also seems similar to rust-mobile/android-activity#43

But here it can't just be the size of the titlebar that's forgotten to be taken into account. There is none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants