At the moment my activity calls
requestWindowFeature(Window.FEATURE_NO_TITLE)
window.setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN)
inside of its onCreate method in order to hide the status bar and display in fullscreen mode.
As part of the migration to Android 30 I replace window.setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN) with WindowInsetsController#hide(statusBars()) as documentation suggests. However, the behaviour of these two approaches is not the same. While the deprecated one smoothly hides the status bar the modern one makes the content of the activity to "jump" when the status bar is hidden.
Has anybody observed the same behaviour and found a fix for it?
I'm not sure if it fits your specific purpose since I had to rework my code a lot for a satisfactory solution, but I managed to get rid of the "jumping" with the following code in my Activity (I use the Compat classes to avoid having to code multiple implementations, but the original classes work the same):
I had a toggling solution before which showed the system and navigation bar on touch (quite similar to the now deprecated documentation, but I was not able to make it work without jumping.
What made the difference for me was to use
WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE. The documentation about this option says the following:By the way, since the official documentation still uses deprecated code as of today I marked it as "unusable documentation" down below in the hope that it will get updated sooner.