Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Immersive Mode" Android app. All documentation is deprecated

I'm trying to make my app run in fullscreen mode where the navigation bar and the status bar is hidden. All documentation I can find seems to be deprecated and the only one that I could find that seemed to not be deprecated in Kotlin is setDecorFitsSystemWindows(false) but that errors with

java.lang.NoSuchMethodError: No virtual method setDecorFitsSystemWindows(Z)V in class Landroid/view/Window; or its super classes (declaration of 'android.view.Window' appears in /system/framework/framework.jar!classes3.dex)

How do you make an app fullscreen now in Android Kotlin?

like image 396
Badflar Avatar asked Jul 06 '20 20:07

Badflar


1 Answers

There are one alternative solution.

Update androidx.core library

implementation "androidx.core:core-ktx:1.5.0-alpha05"

Instead of

activity?.window?.setDecorFitsSystemWindows(false)

Use new api

activity?.window?.run{
     WindowCompat.setDecorFitsSystemWindows(this, false)
}
like image 194
Vahe Gharibyan Avatar answered Oct 02 '22 17:10

Vahe Gharibyan