Android Question Z Order of Panels

bocker77

Active Member
Licensed User
Longtime User
If a panel is in front by using BringToFront on an activity and I recursively go through the activity's views picking off the panels will the first panel that I get be the panel in front? Or does Android not look at z ordering that way?
 

megzz

Member
Licensed User
Longtime User
If a panel is in front by using BringToFront on an activity and I recursively go through the activity's views picking off the panels will the first panel that I get be the panel in front? Or does Android not look at z ordering that way?

for example if you have 5 panel in activity
you write a function for Priority of panels
B4X:
Sub Globals
    Dim panel(5) As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
    For i=0 To 4
        panel(i).Initialize("panel")
        panel(i).Color = Colors.red
        Activity.AddView(panel(i),0,0,100%x,100%y)
        Dim lbl As Label
        lbl.Initialize("")
        lbl.Text = "page " & (i+1)
        panel(i).AddView(lbl,0,50dip,100%x,30dip)
    Next
    Elevation(1) ' this code show panel view index (start 1 to 5)
End Sub
Sub Elevation(Priority)
    Priority=Priority-1
    For i=0 To 4
        If i<>Priority Then
            panel(i).SendToBack
        End If
    Next
    panel(Priority).BringToFront
End Sub

In the above code, the order is followed !!
 
Upvote 0
Top