Hi There
I encountered an interesting problem and I am wondering if any one can provide an explanation.
The code I am attaching, displays a popup similar to a spinner.
If the manifest file contains the line below, then all is fine
if I comment out the above and replace with the line below, then the scrollview goes behind btnBackground and therefore it is not visible
Please check the note in the middle of the code to duplicate the issue.
I am providing the code in here
Thanks in advance.
iCAB
I encountered an interesting problem and I am wondering if any one can provide an explanation.
The code I am attaching, displays a popup similar to a spinner.
If the manifest file contains the line below, then all is fine
B4X:
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
if I comment out the above and replace with the line below, then the scrollview goes behind btnBackground and therefore it is not visible
B4X:
CreateResourceFromFile(Macro, Themes.LightTheme)
Please check the note in the middle of the code to duplicate the issue.
I am providing the code in here
B4X:
Private Sub AddSpinner()
Dim dblNextTop As Double
PopupPanel.Initialize("ScrollView")
PopupPanel.Color = Colors.ARGB( 121, 0, 0, 0 )
PopupPanel.Elevation = 20dip
pnlMain.AddView( PopupPanel, 0, 0, 100%x, 100%y)
Dim lbl As Label
lbl.Initialize("")
lbl.Color = Colors.RGB(250,250,250)
lbl.Text = "Title"
lbl.TextColor = Colors.Black
lbl.TextSize = 18
lbl.Gravity = Gravity.CENTER
lbl.Typeface = Typeface.DEFAULT_BOLD
PopupPanel.AddView( lbl, 10%x, 20%y, 80%X, 8%y)
dblNextTop = lbl.Top + lbl.Height
Dim btnBackground As Button
btnBackground.Initialize ("")
btnBackground.Tag = "btnBackground"
btnBackground.Color = Colors.Gray
PopupPanel.AddView( btnBackground, 10%x, dblNextTop, 80%x, 30%y)
'*********** How to duplicate the issue
'**** if Visible = true and SetApplicationAttribute(android:theme, "@android:style/Theme.Holo") then no problem
'**** if Visible = true and CreateResourceFromFile(Macro, Themes.LightTheme), then scrollview doesn't move in front of the button, I tried sendtoback doesn't make a difference
btnBackground.Visible = True
Dim svSpinnerPanel As ScrollView
svSpinnerPanel.Initialize2(30%y, "svSpinnerPanel")
svSpinnerPanel.Panel.Height = 0
PopupPanel.AddView( svSpinnerPanel, 10%x, dblNextTop, 80%x, 30%y)
Dim PanelColors(4) As Long = Array As Long ( Colors.blue, Colors.Green, Colors.Red, Colors.Yellow)
For iPanelIndex = 0 To 3
Dim pp1 As Panel
pp1.Initialize("Permission" )
pp1.Tag = "pnl_" & iPanelIndex
pp1.Color = PanelColors( iPanelIndex)
svSpinnerPanel.Panel.AddView(pp1, 0, iPanelIndex * svSpinnerPanel.Height/4, 100%x, svSpinnerPanel.Height/4)
pp1.BringToFront
svSpinnerPanel.Panel.Height = svSpinnerPanel.Panel.Height + svSpinnerPanel.Height/4
' AddSpinnerPanelToScrollView( svSpinnerPanel, iPanelIndex )
Next
svSpinnerPanel.Panel.Height = svSpinnerPanel.Panel.Height + 10%y
dblNextTop = btnBackground.Top + btnBackground.Height
Dim btnDone As Button
btnDone.Initialize ("btnDone")
btnDone.Tag = "btnDone"
PopupPanel.AddView( btnDone, 10%x, dblNextTop, 80%x, 10%y)
btnDone.Color = Colors.White
btnDone.Enabled = True
btnDone.Text = "Done"
btnDone.TextColor = Colors.Green
btnDone.BringToFront
End Sub
Private Sub btnDone_Click
PopupPanel.RemoveAllViews
PopupPanel.RemoveView
End Sub
Thanks in advance.
iCAB