Android Question How to apply gradient to status bar?

Status
Not open for further replies.

Erel

B4X founder
Staff member
Licensed User
Longtime User
The solution in that post causes the standard action bar to be hidden. You need to recreate it yourself.

SS-2018-06-03_08.56.15.png


Example of a an activity that is extended into the status bar. Note that only the Android 5+ layout was tested.

New B4XPages example:
 

Attachments

  • 1.zip
    8.9 KB · Views: 902
Last edited:
Upvote 0

jtare

Active Member
Licensed User
Longtime User
Thank you for the example project.
I'm using appcompat with no actionbar, I use a toolbar as actionbar (added in the designerview), I had to move 20dip down the toolbar and content panel, then set the same gradient color for the activity background and for the toolbar and seems to work just fine.
 
Upvote 0

jtare

Active Member
Licensed User
Longtime User
Status bar height seems to be 25dip, not 20dip. Is this correct? Or depends on the screen?
 
Upvote 0

jtare

Active Member
Licensed User
Longtime User
For some reason, now when I tried to input text on a edittext the keyboard covers the view, before it moved up to always make it visible. I tried to add this to the manifest editor but nothing happened, the view gets covered by the keyboard.
B4X:
SetActivityAttribute(Main,  android:windowSoftInputMode, "stateHidden|adjustPan")

I assume this is related with the modifications done to the status bar
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

moinamh

Member
The solution in that post causes the standard action bar to be hidden. You need to recreate it yourself.

SS-2018-06-03_08.56.15.png


Example of an activity that is extended into the status bar. Note that only the Android 5+ layout was tested.

I tried using this code in B4XPages:
B4X:
    Dim ph As Phone
    If ph.SdkVersion >= 4.4 Then
        Dim jo As JavaObject
        Dim window As JavaObject = jo.InitializeContext.RunMethod("getWindow", Null)
        window.RunMethod("addFlags", Array(Bit.Or(0x00000200, 0x08000000)))
        Root.Height = Root.Height +80dip
    End If
        Dim pnl As Panel
        pnl.Initialize("")
        pnl.Color = Colors.Transparent
        Root.AddView(pnl, 0, Root.Height + 24dip, 100%x, 80dip)
The statusbar got transparented but the bottom of the page shown as a white space. like this image (Yeap , thats NavigationBar) :
B4a_SS.PNG

That Code works fine for normal activity , but I got no idea how to solve the problem in B4X Page.
 
Upvote 0
Status
Not open for further replies.
Top