Android Question Problems with IME_HeightChanged Transparent StatusBar Using B4XPages

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
IME_HeightChanged is not responding when I use transparent StatusBar using B4XPages as explained by @Erel here https://www.b4x.com/android/forum/threads/transparent-statusbar-using-b4xpages.125562/
My code is:
B4X:
Sub Activity_Create(FirstTime As Boolean)
    Dim jo As JavaObject
    Dim window As JavaObject = jo.InitializeContext.RunMethod("getWindow", Null)
    window.RunMethod("addFlags", Array(Bit.Or(0x00000200, 0x08000000)))
    Activity.Height = Activity.Height + 80dip
    Dim pm As B4XPagesManager
    pm.Initialize(Activity)
    IME.Initialize("IME")
    IME.AddHeightChangedEvent
    CorrectHeight = 100%y
    Wait For IME_HeightChanged (NewHeight As Int, OldHeight As Int)
    CorrectHeight = NewHeight
    HeightChangedFired = True
End Sub

Sub IME_HeightChanged (NewHeight As Int, OldHeight As Int)
    Log("IME_HeightChanged")
    B4XPages.GetManager.RaiseEvent(B4XPages.GetManager.GetTopPage, "IME_HeightChanged", Array(NewHeight, OldHeight))
End Sub
 

Marvel

Active Member
Licensed User
How could it be countered?
I also faced this last week with transparent status bar. Apparently, it is a known limitation that has been around for years and has not been corrected. What I did was to set the status bar color to match the current background so it at least looks close to what is in the design. Apart from that, I don't think you will find any workaround until you remove the transparent status bar feature.

You can use this to set status bar colour

B4X:
Sub SetStatusBarColor
    Dim p As Phone
    If p.SdkVersion >= 21 Then
        Dim jo As JavaObject
        jo.InitializeContext
        Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
        window.RunMethod("addFlags", Array (0x80000000))
        window.RunMethod("clearFlags", Array (0x04000000))
        If selectThemeColor Then
            window.RunMethod("setStatusBarColor", Array(0xFFFFFF)
        Else
            window.RunMethod("setStatusBarColor", Array(Colors.White))
        End If
    End If
End Sub
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
I also faced this last week with transparent status bar. Apparently, it is a known limitation that has been around for years and has not been corrected. What I did was to set the status bar color to match the current background so it at least looks close to what is in the design. Apart from that, I don't think you will find any workaround until you remove the transparent status bar feature.

You can use this to set status bar colour

B4X:
Sub SetStatusBarColor
    Dim p As Phone
    If p.SdkVersion >= 21 Then
        Dim jo As JavaObject
        jo.InitializeContext
        Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
        window.RunMethod("addFlags", Array (0x80000000))
        window.RunMethod("clearFlags", Array (0x04000000))
        If selectThemeColor Then
            window.RunMethod("setStatusBarColor", Array(0xFFFFFF)
        Else
            window.RunMethod("setStatusBarColor", Array(Colors.White))
        End If
    End If
End Sub
Thanks friend, but I need the screen to be extended since it has a map and the idea is to see it on the entire screen with good aesthetics since applications such as BEAT, UBER etc. They got it.
 
Upvote 0

Marvel

Active Member
Licensed User
Thanks friend, but I need the screen to be extended since it has a map and the idea is to see it on the entire screen with good aesthetics since applications such as BEAT, UBER etc. They got it.

Yeah, they do, but you'll notice that Uber takes you to another screen that does not have a transparent status bar (at least, that's how it works on my phone) even Google maps.

Maybe there is a way to turn off transparent status bar on a new page and reactivate it when you get back to the map page.
 
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
Yeah, they do, but you'll notice that Uber takes you to another screen that does not have a transparent status bar (at least, that's how it works on my phone) even Google maps.

Maybe there is a way to turn off transparent status bar on a new page and reactivate it when you get back to the map page.
I tried that too but nothing.
It will be time to add an Activity
 
Upvote 0
Top