EricDalton
New Member
Hi,
In B4A I’m trying to use Edge-To-Edge for Android 15+ (SDK 35+), and it works correctly.
For devices below Android 15, I use the following code to make the StatusBar and NavigationBar transparent:
I call this method once in Main.
When I create a new Page, everything works properly.
However, inside B4XMainPage, on devices below Android 15, I get the following issue:
The Root panel does not extend fully to the bottom of the Activity. There is an empty gap at the bottom of the screen, as if the Root height is shortened. Even this line has no effect:
These are my manifest entries:
Any help would be appreciated. Thanks! 
In B4A I’m trying to use Edge-To-Edge for Android 15+ (SDK 35+), and it works correctly.
For devices below Android 15, I use the following code to make the StatusBar and NavigationBar transparent:
B4X:
Sub MakeSystemBarsTransparent(act As Activity)
Dim jo As JavaObject
Dim window As JavaObject = jo.InitializeContext.RunMethod("getWindow", Null)
Try
Dim WindowCompat As JavaObject
WindowCompat.InitializeStatic("androidx.core.view.WindowCompat")
WindowCompat.RunMethod("setDecorFitsSystemWindows", Array(window, False))
Catch
End Try
Try
window.RunMethod("setNavigationBarContrastEnforced", Array(False))
Catch
End Try
Try
window.RunMethod("clearFlags", Array(Bit.Or(0x04000000, 0x00000002)))
window.RunMethod("addFlags", Array(0x80000000))
Catch
End Try
Try
window.RunMethod("setStatusBarColor", Array(0x00000000))
window.RunMethod("setNavigationBarColor", Array(0x00000000))
Catch
End Try
Try
window.RunMethod("setNavigationBarDividerColor", Array(0x00000000))
Catch
End Try
Try
Dim decor As JavaObject = window.RunMethod("getDecorView", Null)
Dim controller As JavaObject
controller.InitializeNewInstance("androidx.core.view.WindowInsetsControllerCompat", Array(window, decor))
controller.RunMethod("setAppearanceLightStatusBars", Array(False))
Try
controller.RunMethod("setAppearanceLightNavigationBars", Array(False))
Catch
End Try
Catch
End Try
Try
Dim decor As JavaObject = window.RunMethod("getDecorView", Null)
Dim flags As Int = Bit.Or(Bit.Or(0x00000400, 0x00000200), 0x00000100)
If GetDeviceSDKVersion >= 19 Then flags = Bit.Or(flags, 0x00001000)
decor.RunMethod("setSystemUiVisibility", Array(flags))
Catch
End Try
If GetDeviceSDKVersion < 35 Then
act.Height = act.Height + GetStatusBarHeight + GetNavigationBarHeight
End If
End Sub
When I create a new Page, everything works properly.
However, inside B4XMainPage, on devices below Android 15, I get the following issue:
The Root panel does not extend fully to the bottom of the Activity. There is an empty gap at the bottom of the screen, as if the Root height is shortened. Even this line has no effect:
B4X:
Root.Height = Root.Height + 50dip
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="35"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
'End of default text.
CreateResource(values, theme.xml,
<resources>
<style name="MyAppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="android:windowDisablePreview">true</item>
<item name="colorPrimary">#191919</item>
<item name="colorPrimaryDark">#1F1F1F</item>
<item name="colorAccent">#5F3FAF</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>
</resources>
)
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)