Share via

Creating an AnimationSet & objectAnimator in Code

Nathan Sokalski 4,111 Reputation points
2021-12-17T20:56:43.2+00:00

I am trying to create an AnimationSet in code. I am able to create a static AnimationSet in xml using the set & objectAnimator tags, but I need to do this in code, because I will have a different number of and different values for the objectAnimator tags. I have found AnimationSet & AnimationUtils. My AnimationSet (my set tag if I were to use xml) would always be the same and would have the ordering attribute set to "sequentially". The objectAnimator tags, for which there would be different numbers with different values for the attributes. The attributes that would need to be set are propertyName (which would always be set to "fillColor"), duration, valueFrom & valueTo (valueFrom & valueTo will always be equal, because my goal is to display the color for a fixed amount of time). How can I create a series of objectAnimator(s) and add them to a new AnimationSet?

Developer technologies | .NET | Xamarin

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.