Why is my navigation bar's background misaligned with the actual orientation?

38 Views Asked by At

Right now in the Android app I'm working on, I'm trying to figure out why, after rotating the device to landscape, my navbar's background still thinks the app is in portrait mode (and lays itself out at the bottom of my screen) when the navbar is already to the right of my screen.

Is it something to do with passing modified/wrong insets as the result of the OnApplyWindowInsetsListener put in the window.decorView?

1

There are 1 best solutions below

0
Gensoukyou1337 On

Note to self: NEVER set an OnApplyWindowInsetsListener to the window.decorView. It replaces the decorView's own insets listener, and said listener is the one laying out and animating the navigation bar and status bar backgrounds.

At maximum, use the Activity binding's root or the Fragment's view instead.