Home > Back-end >  remove white space from the navigation bar android
remove white space from the navigation bar android

Time:09-23

I am trying to enable full screen mode but the problem is that there is permanent white space at the navigation bar which does not hide at all. I need to remove that white space. Here is the implementation

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:id="@ id/player_layout"
    >

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        app:elevation="0dp"
        >

        <androidx.appcompat.widget.Toolbar
            android:id="@ id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="@color/black"
            />
           

    </com.google.android.material.appbar.AppBarLayout>


    <com.google.android.exoplayer2.ui.PlayerView
        android:id="@ id/exoplayer_video"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/black"
        app:controller_layout_id="@layout/custom_controller"
        app:resize_mode="fit"
        app:player_layout_id="@layout/exo_simple_player_view"
        app:use_controller="true"
        />

</RelativeLayout>

This is the styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
        <item name="colorPrimary">@color/purple_700</item>
        <item name="colorPrimaryDark">@color/black</item>
        <item name="colorAccent">#F87A8D</item>
        <item name="windowActionModeOverlay">true</item>



        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
        <item name="android:navigationBarColor">@android:color/transparent</item>
       
    </style>

Any suggestion would be helpful to me. Thanks

CodePudding user response:

Theme.MaterialComponents.Light.DarkActionBar

to

Theme.MaterialComponents.Light.NoActionBar

CodePudding user response:

Change the parent theme from

Theme.MaterialComponents.Light.DarkActionBar

to

Theme.MaterialComponents.Light.NoActionBar

OR

If you want full screen only for this activity then do as follow in your AndroidManifest.xml file:

<activity
    android:name=".YourActivityName"
    android:theme="@style/AppTheme.NoActionBar" />

And add below style in your styles.xml

<style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>
  • Related