What is happening is that the panel opens smoothly in a "animation", however it does not "animate" when it is suposed to close down.
It simply vanishes exactly as if I did pnlScore.visible=false.
What am I doing Wrong ?
Many thanks
JM
B4X:
Sub igvMenuScore_Click
If flagmenuscores=False Then
pnlScore.Height=0
pnlScore.Width=0
pnlScore.Visible=True
pnlScore.SetLayoutAnimated(200,85%x,49%y,13%x,51%y)
flagmenuscores=True
Else
pnlScore.SetLayoutAnimated(200,85%x,49%y,0%x,0%y)
flagmenuscores=False
End If
End Sub
PS - Just noticed now that If I use 1%x and 1%y it does "animate", however it does not suit my purpose as a litle bit stays there. If I do a pnlscore.visible=false, after the "animation" it vanishes without any animation (I presume because the instruction is reached a few miliseconds later, so the animation will not run.
Seems like you are hitting an internal optimization of Android where it hides the view if its size is 0. This causes the animation to be hidden as well.
Use 1dip and combine it with a call to SetVisibleAnimated to completely hide it.
I have also found different behaviour between two different devices when using SetLayoutAnimated and it took me almost a day to get it sorted out...using/calling INVALIDATE. Not sure if it is relevant to the above problem but it did sort out the problem I had.