I have been trying to make a fragment fullscreen, but almost every answer on the web has deprecated methods. Even the android official site has a deprecated method Link.
I'm using kotlin and after following this answer, I have tried this in fragment.
override fun onAttach(context: Context) {
super.onAttach(context)
requireActivity().window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
override fun onDetach() {
super.onDetach()
requireActivity().window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
but the result that I got is this
You can clearly see navigation and status bars are still there.
Can you share the proper and latest way to get fullscreen in fragment?