Android Question [SOLVED] What about the order of object creation?

Jerryk

Member
Licensed User
Longtime User
On the page, I load a layout with some visual objects. Then I dynamically create and add the panel. But the panel don't covers the objects from the layout. BringToFront won't help. How to overlay layout?
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    Cover
End Sub

Private Sub Cover
    pOverlay = xui.CreatePanel("")
    pOverlay.SetColorAndBorder(xui.Color_Green, 1%x, xui.Color_Black, 0)
    Root.AddView(pOverlay, 0, 0, 100%x, 50%y)
    pOverlay.BringToFront 'not work
End Sub
 

Sagenut

Expert
Licensed User
Longtime User
B4X:
pOverlay.As(Panel).Elevation = 5dip
Increase the 5dip if not enough.
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Not knowing the rest of your code but you should probably modify
B4X:
pOverlay = xui.CreatePanel("")
in
B4X:
Dim pOverlay as B4XView = xui.CreatePanel("")
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
You could also add the covering panel directly in the layout, and making it visible or not when needed.
But not knowing your exact need I am just guessing.
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
If possible attach the project or an example with the same problem to work on.
 
Upvote 0
Top