To ensure the modern look for my application, I want to make it goes edge-to-edge. Through some research I know that we can achieve it in 3 steps:
- Make the App's layout spreads all the screen. To do this with API 29, we set systemUiVisibility before the layout is inflated. From API 30, we must use window.setDecorFitsSystemWindows(false)
- Make the status bar and navigation bar transparent From API 29, we must set status bar and navigation bar's color to transparent.
- Handle insets.
The problem is, before I came up with the summary, I get some tips and tricks to use
window.setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
)
It works all the time! even with older API version, I think. And I don't even have to change the theme file. And in all the cases, I don't even have to change the translucent. So...why do we need to use many other methods while window.setFlags for FLAG_LAYOUT_NO_LIMITS works all the time?
I tried to make my app goes edge-to-edge using methods mentioned in Android API version 29 and 30. I tried the same with window.setFlags FLAG_LAYOUT_NO_LIMITS.
I expect a unified method that align with Android official site's documentation.