Search code examples
androidandroid-manifestandroid-themeandroid-styles

Android - Make Navigation Bar disappear


I' ve been searching for a while and i cannot find a way to make the nav bar dissapear in android application. Here is my resources from android studio

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" >
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.CustomPop">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowCloseOnTouchOutside">true</item>
</style>

and the manifest

<?xml version="1.0" encoding="utf-8"?>

<permission
    android:name="com.example.....maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />


<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme.NoActionBar"
    android:label="@string/app_name"
    >

    <activity
        android:name=".Class"
        android:theme="@style/AppTheme.CustomPop" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

and what i get here

enter image description here

I want the bar with Maps string to dissapear.

Thanks!


Solution

  • you can hide or show notification bar using flags

    to hide :

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    to show :

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    now for actionBar :

    to hide :

    getSupportActionBar().hide();
    

    to show :

    getSupportActionBar().show();