1

There is some specific area at the bottom of the screen in Android 13:

enter image description here

On the picture above it is transparent, but on the picture below it is not:

enter image description here

How do I control its behaviour in my app? Does app manifest affect this somehow?

Currently I have the following android:theme element in my app manifest:

    <activity android:name="com.myapp.MainActivity"
        android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

where AppTheme is defined in apptheme.xml as follows:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/splash</item>
    </style>
</resources>

and this specific bottom area is black and obscures the bottom elements of my app.

I need to make my app not overlap with this area (I already figured out that the area is bottom Navigation Bar).

EDIT1

My first idea was that it is something related to FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag, but this flag is not set. When I add the following code:

    android.view.Window window = getWindow();
    
    if ((getWindow().getAttributes().flags & android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) != 0)
    {
        Log.d(TAG, "The flag is set.");
    }
    else
    {
        Log.d(TAG, "The flag is NOT set.");
    }

my activity onCreate() I get The flag is NOT set..

Also tried this:

    window.getDecorView().setSystemUiVisibility(
        android.view.View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
        android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

but without a success.

My device is Pixed 2 XL emulator:

enter image description here

EDIT2

Finally I was able to make Navigation Bar transparent with the following code:

    android.view.Window window = getWindow();
    
    window.addFlags(android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

    window.setNavigationBarColor(0x00000000);

but I have no idea on how to make it not overlap with my app window.

Alexey Starinsky
  • 3,699
  • 3
  • 21
  • 57

1 Answers1

1

You can try this code in the main()

SystemChrome.setSystemUIOverlayStyle(
  const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent),
);
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
IVλ-N
  • 21
  • 3