mt_heka
Member
I want add StatusBarHeight to main activity and root too but i have problem:
Result:
But I want the Root to cover the entire Activity, and that green area should not be visible.
#In_Activity:
Sub Activity_Create(FirstTime As Boolean)
Dim p As Phone
If p.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)))
Activity.Height = Activity.Height + GetStatusBarHeight
Activity.Color = Colors.Green 'for show
End If
Dim pm As B4XPagesManager
pm.Initialize(Activity)
End Sub
Public Sub GetStatusBarHeight As Int
Dim jo As JavaObject
jo.InitializeContext
Dim resources As JavaObject = jo.RunMethod("getResources", Null)
Dim resId As Int = resources.RunMethod("getIdentifier", Array("status_bar_height", "dimen", "android"))
If resId > 0 Then
Return resources.RunMethod("getDimensionPixelSize", Array(resId))
Else
Return 0
End If
End Sub
#In_B4XPages:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.Color = Colors.Red
End Sub
Result:
But I want the Root to cover the entire Activity, and that green area should not be visible.