Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
' Setup the black cover panel.
'-----------------------------
cdBackgroundColour.Initialize(Colors.ARGB(150, 0, 0, 0), 0) ' Transparent background.
pnlBlackCover.Background = cdBackgroundColour ' Assign the transparent colour to panel.
pnlBlackCover.Visible = False
pnlBlackCover.SetElevationAnimated(0, 3dip) ' Make the animation cover more.
Root.AddView(pnlBlackCover, 0, 0, Root.Width, Root.Height) ' Add the panel.
' Setup the white dialog panel.
'------------------------------
cdBackgroundColour.Initialize(Colors.White, 50dip) ' White rounded background.
pnlWhiteDialog.SetElevationAnimated(0, 3dip) ' Make the animation cover more.
pnlWhiteDialog.LoadLayout("NewAccount") ' Layout with new account entry fields.
pnlWhiteDialog.Background = cdBackgroundColour ' Assign the white colour to panel.
pnlWhiteDialog.Width = Root.Width
' Add a panel with the top of it at half the height of the activity (root).
' It's height will go to the bottom of the activity (root) which is also half the
' height of the activity (root) plus some extra height (.7) so the rounded bottom
' is hidden when it's displayed.
' It's also placed out of site (the "top" parameter is at Root.Height) to be slid
' into view later with SetLayoutAnimated.
'---------------------------------------------------------------------------------
Root.AddView(pnlWhiteDialog, 0, Root.Height, Root.Width, Root.Height * .7)
End Sub