0

In the android studio, you can easily remove the status bar by adding a line in the themes.xml file.

<item name="android:windowFullscreen">true</item>

This simple one-line code will hide the status bar. If the user touches the top part of the screen, it appears but after 1 or 2 seconds it disappears again. Is there a similar way to achieve the same effect for the navigation bar?

I know this question has been answered previously but those methods are deprecated and I want to know if there is a simple solution like mentioned above? I am using Android Studio Chipmunk 2021.2.1.

Here is my build.gradle file

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.0' apply false
    id 'com.android.library' version '7.2.0' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
Joy Karmoker
  • 139
  • 13

1 Answers1

0

In your onCreate method for your activity you can use:

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        val actionBar: ActionBar = getSupportActionBar() //Get action bar reference
        actionBar.hide() //Hide the action bar
    }
Ars_Codicis
  • 440
  • 1
  • 4
  • 16