Original tutorial: Immersive Mode - hide the navigation bar (by @Erel )
So the above tutorial works for those devices which do not have a Notch. Devices with a notch will crop the bottom of the application content.
Solution (Project attached):
Add this code to GetRealSize sub of the original tutorial after lv.Height = point.GetField("y"):
USE NOTCH AREA (API 28):
If it has a Notch and you want to use the Notch area then just add this code to Manifest:
NOTE: android:windowLayoutInDisplayCutoutMode provided by the APIs in Android Pie 9.0 (API 28).
So the above tutorial works for those devices which do not have a Notch. Devices with a notch will crop the bottom of the application content.
Solution (Project attached):
Add this code to GetRealSize sub of the original tutorial after lv.Height = point.GetField("y"):
B4X:
Dim r As Rect
r.Initialize(0,0,0,0)
Dim WindowVisibleDisplayFrame As JavaObject = ctxt.RunMethodJO("getWindow", Null)
WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO("getDecorView", Null)
WindowVisibleDisplayFrame = WindowVisibleDisplayFrame.RunMethodJO("getWindowVisibleDisplayFrame",Array(r))
If GetDeviceLayoutValues.Width > GetDeviceLayoutValues.Height Then
lv.Width = lv.Width - r.left
Else
lv.Height = lv.Height - r.top
End If
USE NOTCH AREA (API 28):
If it has a Notch and you want to use the Notch area then just add this code to Manifest:
B4X:
SetApplicationAttribute(android:theme, "@style/CustomTheme")
CreateResource(values, theme.xml,
<resources>
<style name="CustomTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
</resources>)
Attachments
Last edited: