Android Question [SOLVED] SDK 36 + Edge to Edge + Non B4X Pages + Full screen

Jmu5667

Well-Known Member
Licensed User
Longtime User
Using the non B4X pages template, I have noticed that the 'show title' flag for the Activity in the designer seems ineffective. We have an existing, Atlas SOS, it's not been converted to B4X pages yet. I have put :

B4X:
' // 2026.07.30 - SDK 36 Upgrade
Try
ime.Initialize("ime")
root = xui.CreatePanel("")
Dim Content As Rect = ime.GetContentRect
        Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
        ime.UpdatePercentageReference(root.Width, root.Height)
root.LoadLayout("Layout")
        ime.AddHeightChangedEvent
        ime.HideKeyboard
Catch
mod_functions.writelog($"main::Activity_Create::SDK36 Upgrade:: -error- ${LastException.Message}"$)
End Try

in main::activity_create and the app still covers the whole screen, so the effect is the system bar at the top is overlayed on the app.

1785408905136.png


1785408941182.png


app still covers the whole screen, so the effect is the system bar at the top is overlayed on the app.
 
Last edited:
Solution
I have solved all issues and the app is now backward compatible with previous versions of Android.

What I did -

Main::Activity_Create
B4X:
' // 2026.07.30 - SDK 36 Upgrade
    Activity.Color = 0xFFC8001F
    ime.Initialize("ime")
    If ime.IsEdgeToEdge Then
        Try
            root = xui.CreatePanel("")       
            Dim Content As Rect = ime.GetContentRect                   
            Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
            ime.UpdatePercentageReference(root.Width, root.Height)
            root.LoadLayout("layout")       
            ime.AddHeightChangedEvent
            ime.HideKeyboard
            thisTop = Content.Top
        Catch...

Erel

B4X founder
Staff member
Licensed User
Longtime User
It looks like your app configuration is more complicated, but start with my example:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    ime.Initialize("ime")
    root = xui.CreatePanel("")
    Dim Content As Rect = ime.GetContentRect
    Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
    ime.UpdatePercentageReference(root.Width, root.Height)
    root.LoadLayout("Layout")
End Sub

1785414691007.png


This is on an Android 16 or 17 so it runs in E2E mode. I also tested it on an older device with #EdgeToEdgeOldDevices: False and it looks properly.

Note that you can test E2E with:
B4X:
Log(ime.IsEdgeToEdge)
 

Attachments

  • 111.zip
    9.2 KB · Views: 155
Upvote 0

fernando1987

Active Member
Licensed User
Longtime User
It seems like the error occurs when the content is inside a ScrollView and the status bar is set to transparent.
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
I did test the B4XPages + B4XDrawer example and it worked fine. If you think that there is an issue here, then please create a small example with the drawer and the relevant settings.
Good Morning, I have no doubt that B4Xpages is fine, my testing with a Non Pages app. I will keep you updated with my findings.

Thanks

John.
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
So this is where i am at now. As you can see the notification area is white, need to fix this, You can see the devuice is charging as the battery level indicator is green.

1785487138578.png


I needed to modify B4XDrawer class initialze to this :
B4X:
Public Sub Initialize (Callback As Object, EventName As String, Parent As B4XView, SideWidth As Int)
    ' // SDK 36 mod
    Dim ime As IME
    ime.Initialize("")   
    Dim Content As Rect = ime.GetContentRect
   
    mEventName = EventName
    mCallBack = Callback
    mSideWidth = SideWidth
    #if B4A
        Dim creator As TouchPanelCreator
        mBasePanel = creator.CreateTouchPanel("base")
    #else if B4i
        mBasePanel = xui.CreatePanel("")
        Dim nme As NativeObject = Me
        Dim no As NativeObject = mBasePanel
        no.RunMethod("addGestureRecognizer:", Array(nme.RunMethod("CreateRecognizer", Null)))
    #End If
   
    ' // SDK 36 mod
    If ime.IsEdgeToEdge Then
        Parent.AddView(mBasePanel, Content.left, Content.top, Parent.Width, Parent.Height)
    Else
        Parent.AddView(mBasePanel, 0, 0, Parent.Width, Parent.Height)
    End If
 
   mCenterPanel = xui.CreatePanel("") 
   
    mBasePanel.AddView(mCenterPanel, 0, 0, mBasePanel.Width, mBasePanel.Height)
    mDarkPanel = xui.CreatePanel("dark")
   
    mBasePanel.AddView(mDarkPanel, 0, 0, mBasePanel.Width, mBasePanel.Height)
   
    mLeftPanel = xui.CreatePanel("LeftPanel")
    mBasePanel.AddView(mLeftPanel, -SideWidth, 0, SideWidth, mBasePanel.Height)
    mLeftPanel.Color = xui.Color_Red
   
    #if B4A
        Dim p As Panel = mLeftPanel
        p.Elevation = 4dip
    #Else If B4i
        Dim p As Panel = mDarkPanel
        p.UserInteractionEnabled = False
        p.SetBorder(0, 0, 0)
        p = mLeftPanel
       
        p = mCenterPanel
        p.SetBorder(0, 0, 0)
        p = mBasePanel
        p.SetBorder(0, 0, 0)
    #End If
End Sub

Regards

John.
 
Last edited:
Upvote 0

LucasHeer

Active Member
Licensed User
Longtime User
So this is where i am at now. As you can see the notification area is white, need to fix this, You can see the devuice is charging as the battery level indicator is green.

View attachment 172709

I needed to modify B4XDrawer class initialze to this :
B4X:
Public Sub Initialize (Callback As Object, EventName As String, Parent As B4XView, SideWidth As Int)
    ' // SDK 36 mod
    Dim ime As IME
    ime.Initialize("")  
    Dim Content As Rect = ime.GetContentRect
  
    mEventName = EventName
    mCallBack = Callback
    mSideWidth = SideWidth
    #if B4A
        Dim creator As TouchPanelCreator
        mBasePanel = creator.CreateTouchPanel("base")
    #else if B4i
        mBasePanel = xui.CreatePanel("")
        Dim nme As NativeObject = Me
        Dim no As NativeObject = mBasePanel
        no.RunMethod("addGestureRecognizer:", Array(nme.RunMethod("CreateRecognizer", Null)))
    #End If
  
    ' // SDK 36 mod
    If ime.IsEdgeToEdge Then
        Parent.AddView(mBasePanel, Content.left, Content.top, Parent.Width, Parent.Height)
    Else
        Parent.AddView(mBasePanel, 0, 0, Parent.Width, Parent.Height)
    End If
 
   mCenterPanel = xui.CreatePanel("")
  
    mBasePanel.AddView(mCenterPanel, 0, 0, mBasePanel.Width, mBasePanel.Height)
    mDarkPanel = xui.CreatePanel("dark")
  
    mBasePanel.AddView(mDarkPanel, 0, 0, mBasePanel.Width, mBasePanel.Height)
  
    mLeftPanel = xui.CreatePanel("LeftPanel")
    mBasePanel.AddView(mLeftPanel, -SideWidth, 0, SideWidth, mBasePanel.Height)
    mLeftPanel.Color = xui.Color_Red
  
    #if B4A
        Dim p As Panel = mLeftPanel
        p.Elevation = 4dip
    #Else If B4i
        Dim p As Panel = mDarkPanel
        p.UserInteractionEnabled = False
        p.SetBorder(0, 0, 0)
        p = mLeftPanel
      
        p = mCenterPanel
        p.SetBorder(0, 0, 0)
        p = mBasePanel
        p.SetBorder(0, 0, 0)
    #End If
End Sub

Regards

John.

I have light/dark pages throughout my apps, and I do not seem to have this issue. However, I do this in all of my B4XPage_Appear subs:

Globals.SetStatusBarColor(Globals.theme_backgroundColor, True)

SetStatusBarColor:
Sub SetStatusBarColor(clr As Int, lightIcons As Boolean)
    #If B4A
        Dim p As Phone
        If p.SdkVersion < 21 Then Return ' requires Lollipop+
        Dim jo As JavaObject
        jo.InitializeContext
        Dim w As JavaObject = jo.RunMethod("getWindow", Null)
        ' enable drawing system bar backgrounds
        w.RunMethod("addFlags", Array(0x80000000))            ' FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
        w.RunMethod("clearFlags", Array(0x04000000))          ' FLAG_TRANSLUCENT_STATUS
        w.RunMethod("setStatusBarColor", Array(clr))
        ' icon color (API 23+): LIGHT_STATUS_BAR = dark icons
        If p.SdkVersion >= 23 Then
            Dim decor As JavaObject = w.RunMethod("getDecorView", Null)
            Dim vis As Int = decor.RunMethod("getSystemUiVisibility", Null)
            Dim LIGHT_STATUS As Int = 0x00002000
            If lightIcons Then            ' -> dark icons
                vis = Bit.Or(vis, LIGHT_STATUS)
            Else                          ' -> light (white) icons
                If Bit.And(vis, LIGHT_STATUS) <> 0 Then vis = Bit.Xor(vis, LIGHT_STATUS)
            End If
            decor.RunMethod("setSystemUiVisibility", Array(vis))
        End If
    #Else If B4i
    ' On iOS the status bar rides on the navigation bar color
        Dim no As NativeObject = Main.NavControl
        no.GetField("navigationBar").RunMethod("setBarTintColor:", Array(no.ColorToUIColor(clr)))
        no.GetField("view").As(View).Color = clr   ' background behind bar (under large titles, etc.)

        ' Text / icon color: 0 = default (dark), 1 = light content (white)
        Dim app As NativeObject = Main.App
        If lightIcons Then
            app.RunMethod("setStatusBarStyle:", Array(0)) ' dark icons
        Else
            app.RunMethod("setStatusBarStyle:", Array(1)) ' white icons
        End If
    #End If
End Sub

and set Root.Color in B4XPage_Created.

I wonder if this could help.
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi, thanks for the input, but this is not a b4xpages issue, it a non pages issue. I have pretty much solved the all issues and will publish the results later
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
I have solved all issues and the app is now backward compatible with previous versions of Android.

What I did -

Main::Activity_Create
B4X:
' // 2026.07.30 - SDK 36 Upgrade
    Activity.Color = 0xFFC8001F
    ime.Initialize("ime")
    If ime.IsEdgeToEdge Then
        Try
            root = xui.CreatePanel("")       
            Dim Content As Rect = ime.GetContentRect                   
            Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
            ime.UpdatePercentageReference(root.Width, root.Height)
            root.LoadLayout("layout")       
            ime.AddHeightChangedEvent
            ime.HideKeyboard
            thisTop = Content.Top
        Catch
            mod_functions.writelog($"main::Activity_Create::SDK36 Upgrade:: -error- ${LastException.Message}"$)
        End Try
    End If

B4XDrawer:Initialize
B4X:
Public Sub Initialize (Callback As Object, EventName As String, Parent As B4XView, SideWidth As Int)
   
    Dim ime As IME
    ime.Initialize("")   
    Dim Content As Rect = ime.GetContentRect
   
    mEventName = EventName
    mCallBack = Callback
    mSideWidth = SideWidth
    #if B4A
        Dim creator As TouchPanelCreator
        mBasePanel = creator.CreateTouchPanel("base")
    #else if B4i
        mBasePanel = xui.CreatePanel("")
        Dim nme As NativeObject = Me
        Dim no As NativeObject = mBasePanel
        no.RunMethod("addGestureRecognizer:", Array(nme.RunMethod("CreateRecognizer", Null)))
    #End If
   
    ' // 2026.07.31 - SDK 36 Upgrade
    If ime.IsEdgeToEdge Then
        Parent.AddView(mBasePanel, Content.left, Content.top, Parent.Width, Parent.Height)
    Else
        Parent.AddView(mBasePanel, 0, 0, Parent.Width, Parent.Height)
    End If
    mCenterPanel = xui.CreatePanel("")   
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mBasePanel.AddView(mCenterPanel, 0, 0, mBasePanel.Width, Content.Height)
    mDarkPanel = xui.CreatePanel("dark")
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mBasePanel.AddView(mDarkPanel, 0, 0, mBasePanel.Width, Content.Height)
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mLeftPanel = xui.CreatePanel("LeftPanel")   
    mBasePanel.AddView(mLeftPanel, -SideWidth, 0, SideWidth, Content.Height)
   
    mLeftPanel.Color = xui.Color_Red
   
    #if B4A
        Dim p As Panel = mLeftPanel
        p.Elevation = 4dip
    #Else If B4i
        Dim p As Panel = mDarkPanel
        p.UserInteractionEnabled = False
        p.SetBorder(0, 0, 0)
        p = mLeftPanel
       
        p = mCenterPanel
        p.SetBorder(0, 0, 0)
        p = mBasePanel
        p.SetBorder(0, 0, 0)
    #End If
End Sub

1785493809536.png
1785493859793.png


I have a few more activities to do but it's working well. Consider setting a public value in main - thisTop = Content.Top so other activies can use. I have done this as I use Dialog.PutAtTop = True, which I have replace with Dialog.Base.Top = thisTop

Regards

John.
 
Last edited:
Upvote 0
Solution

Erel

B4X founder
Staff member
Licensed User
Longtime User
 
Upvote 0

Cebuvi

Active Member
Licensed User
Longtime User
I have solved all issues and the app is now backward compatible with previous versions of Android.

What I did -

Main::Activity_Create
B4X:
' // 2026.07.30 - SDK 36 Upgrade
    Activity.Color = 0xFFC8001F
    ime.Initialize("ime")
    If ime.IsEdgeToEdge Then
        Try
            root = xui.CreatePanel("")      
            Dim Content As Rect = ime.GetContentRect                  
            Activity.AddView(root, Content.Left, Content.Top, Content.Width, Content.Height)
            ime.UpdatePercentageReference(root.Width, root.Height)
            root.LoadLayout("layout")      
            ime.AddHeightChangedEvent
            ime.HideKeyboard
            thisTop = Content.Top
        Catch
            mod_functions.writelog($"main::Activity_Create::SDK36 Upgrade:: -error- ${LastException.Message}"$)
        End Try
    End If

B4XDrawer:Initialize
B4X:
Public Sub Initialize (Callback As Object, EventName As String, Parent As B4XView, SideWidth As Int)
  
    Dim ime As IME
    ime.Initialize("")  
    Dim Content As Rect = ime.GetContentRect
  
    mEventName = EventName
    mCallBack = Callback
    mSideWidth = SideWidth
    #if B4A
        Dim creator As TouchPanelCreator
        mBasePanel = creator.CreateTouchPanel("base")
    #else if B4i
        mBasePanel = xui.CreatePanel("")
        Dim nme As NativeObject = Me
        Dim no As NativeObject = mBasePanel
        no.RunMethod("addGestureRecognizer:", Array(nme.RunMethod("CreateRecognizer", Null)))
    #End If
  
    ' // 2026.07.31 - SDK 36 Upgrade
    If ime.IsEdgeToEdge Then
        Parent.AddView(mBasePanel, Content.left, Content.top, Parent.Width, Parent.Height)
    Else
        Parent.AddView(mBasePanel, 0, 0, Parent.Width, Parent.Height)
    End If
    mCenterPanel = xui.CreatePanel("")  
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mBasePanel.AddView(mCenterPanel, 0, 0, mBasePanel.Width, Content.Height)
    mDarkPanel = xui.CreatePanel("dark")
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mBasePanel.AddView(mDarkPanel, 0, 0, mBasePanel.Width, Content.Height)
    ' // 2026.07.31 - SDK 36 Upgrade - set correct height with Content.Height
    mLeftPanel = xui.CreatePanel("LeftPanel")  
    mBasePanel.AddView(mLeftPanel, -SideWidth, 0, SideWidth, Content.Height)
  
    mLeftPanel.Color = xui.Color_Red
  
    #if B4A
        Dim p As Panel = mLeftPanel
        p.Elevation = 4dip
    #Else If B4i
        Dim p As Panel = mDarkPanel
        p.UserInteractionEnabled = False
        p.SetBorder(0, 0, 0)
        p = mLeftPanel
      
        p = mCenterPanel
        p.SetBorder(0, 0, 0)
        p = mBasePanel
        p.SetBorder(0, 0, 0)
    #End If
End Sub

View attachment 172710 View attachment 172711

I have a few more activities to do but it's working well. Consider setting a public value in main - thisTop = Content.Top so other activies can use. I have done this as I use Dialog.PutAtTop = True, which I have replace with Dialog.Base.Top = thisTop

Regards

John.
In my app, I'm using the B4XDrawer library, and I have two questions:

- Does the code for the B4XDrawer:Initialize subroutine need to be added to the activity where the drawer will be located?

- Does it need to be called after the Activity_Create code?
 
Upvote 0

Jmu5667

Well-Known Member
Licensed User
Longtime User
In my app, I'm using the B4XDrawer library, and I have two questions:

- Does the code for the B4XDrawer:Initialize subroutine need to be added to the activity where the drawer will be located?

- Does it need to be called after the Activity_Create code?
I am using the B4XDrawer class and I modifed the initialize to fix the issue I was having.
 
Upvote 0

Cebuvi

Active Member
Licensed User
Longtime User
Thanks for the reply. I tested the B4XDrawer class, and it works correctly.

I hope there will be an update to the B4XDrawer library to make it compatible with SK36 and Edge to Edge.
 
Upvote 0
Top