I found out one more thing, if the line below is removed from the example it also works,
enableEdgeToEdge()
And, it work better for the devices which have on screen navigation buttons (back, recent and home button)