Android Question Animation InitializeTranslate problem

msali

Member
Licensed User
Longtime User
Hi all,
I have a panel that i have been able to animate using Translate. I have done it successfully for
  • Left to right movement
  • right to left movement
  • down to up movement
But for some odd reason I am unable to do the Up to down.
The problem is that it does the animation but but after completing the animation the panel along with its content flicker for a micro second.

I have tired this code on Galaxy S9+, and Huawei Mate 8 and another cheap testing phone that i have.

All the above are working fine except Up to down to hide the panel


My code is

B4X:
Public Sub ShowPanel(pnl As Panel)
    pnl.Visible= True
    Dim Ani    As Animation
    Ani.InitializeTranslate("", 0, Activity.Height, 0, 0)
    Ani.Duration= 500
    Ani.Start(pnl)

End Sub

Public  Sub HidePanel(pnl As Panel)
    Dim Ani    As Animation
    Ani.InitializeTranslate("EndAni", 0, 0, 0, pnl.Height )
    Ani.Duration= 500
    Ani.Start(pnl)
    pnl.Visible= False
End Sub

Sub EndAni_AnimationEnd
    pnlSlide.Visible= False
    Log("End Animation")
End Sub

ShowPanel is working perfectly well. The problem is in HidePanel

Any idea why it is flickering at the end of animation.


Note: I have read many recommendations of using SetLayoutAnimated but I would like to know what is the problem with this code.

Many Thanks in adv.

Regards.
 
Top