Android Question SetLayoutAnimated not working properly ?

JTmartins

Active Member
Licensed User
I have this litle piece of code.

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.
 
Last edited:

eurojam

Well-Known Member
Licensed User
Indeed, it is an interesting behavior:
B4X:
pnlScore.SetLayoutAnimated (  200,85%x,49%y,1dip,1dip)
works like expected and
B4X:
 pnlScore.SetLayoutAnimated(200,85%x,49%y,0,0)
do not....strange...:confused:
 

Johan Schoeman

Expert
Licensed User
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.
 
Top