Android Question AXrLottie multiple views

Blueforcer

Well-Known Member
Licensed User
Longtime User
Im using ASViewPager for different pages with the same layout but differnt content.
Each page has a AnimationPanel where i want to display differen Lottie animations.
Unfortunally each pages shows the very last animation.
I also tried to make different layouts with different animationPanel names, but no success.
What im doing wrong?


B4X:
Dim p As B4XView = xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Root.Width,Root.Height)
    p.LoadLayout("CalibrationBegin")
    AddAnimation("4_einstecken",AnimationPanel1)
    NextButton.Tag=0
    ASViewPager1.AddPage(p,"")
 
    Dim p2 As B4XView = xui.CreatePanel("")
    p2.SetLayoutAnimated(0,0,0,Root.Width,Root.Height)
    p2.LoadLayout("CalPh")
    AddAnimation("2_pH7",AnimationPanel2)
    TextLabel.Text=TL.get("#phCalStep2")
    ASViewPager1.AddPage(p2,"")
 
....

Sub AddAnimation(name As String, Target As B4XView)
    Dim LottieView As AXrLottieImageView
    LottieView.Initialize("")
    Target.AddView(LottieView,0,0,Target.Width,Target.Height)
 
    Dim Drawable As AXrLottieDrawableBuilder
    Drawable.InitializeFromJson(File.ReadString(File.DirAssets, name &".json"),"jo") _
                .SetSize(Target.Width,Target.Width) _
                .SetAutoRepeat(Drawable.AUTO_REPEAT_INFINITE) _
                .SetAutoStart(True) _
                .SetCacheEnabled(False)
    LottieView.SetLottieDrawable(Drawable.Build)

End Sub
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…