0

I know there are tons of answers on this nd I have tried a lot of them unfortunately, none has worked for me. I have looked through and implemented this and this and a lot more.

My device is a google pixel 6 and the app I am building does not display full screen on it, the status bar still shows and it remains dark as seen in the screen shots. However, every other app on the device shows in full screen. Prior to debugging on a device, I have been using an emulator for Pixel 6 and it displays in full screen mode on the emulator

Kindly help point out what I am missing

This is my theme's files Day Theme

<!-- Base application theme. -->
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <!-- Primary brand color. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorOnPrimary">@color/white</item>

    <item name="android:windowBackground">@color/white</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

Night theme

<!-- Base application theme. -->
<style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light.NoActionBar">
    <!-- Primary brand color. -->
    <item name="colorPrimary">@color/primary</item>
    <item name="colorOnPrimary">@color/white</item>

    <item name="android:windowBackground">@color/white</item>
    <item name="android:colorBackground">@color/white</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>

AndroidManifest file

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_logo"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_logo_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
    <activity
        android:name=".Activities.AuthenticateActivity"
        android:noHistory="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    <activity
        android:name=".Activities.IntroActivity"
        android:noHistory="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    <activity
        android:name=".Activities.SplashActivity"
        android:exported="true"
        android:noHistory="true"
        android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

And on the onCreate Method of the activities in the manifest file, I implemented this just after setting the page's content

getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

These are the images This is how I expect the status bar This is what I am getting

Jamie
  • 87
  • 1
  • 5

1 Answers1

0

After hours of retrying several other answers this worked

<style name="Theme.MaterialComponents.Light.NoActionBar" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowActivityTransitions">true</item>
</style>

No other line of code added to the activity or xml file.

Jamie
  • 87
  • 1
  • 5