GitHub has an example that lists the use of Nineoldandroids compatible animations very well. Download it down and then run the test under:
Because to refer to the project of Nineoldandroids, I copy it directly into the source code, as a test.
Android 11 version also has objectanimator animation properties, but not compatible with the 10 version or even 8 of the version number, the domestic version of the mobile phone share is not small. So the compatibility must only use this open source.
static {Proxy_properties.put ("alpha", Prehoneycombcompat.alpha); Proxy_properties.put ("Pivotx", prehoneycombcompat.pivot_x); Proxy_properties.put ("Pivoty", prehoneycombcompat.pivot_y); Proxy_properties.put ("Translationx", prehoneycombcompat.translation_x); Proxy_properties.put ("Translationy", prehoneycombcompat.translation_y); Proxy_properties.put ("Rotation", prehoneycombcompat.rotation); Proxy_properties.put ("RotationX", prehoneycombcompat.rotation_x); Proxy_properties.put ("RotationY", prehoneycombcompat.rotation_y); Proxy_properties.put ("ScaleX", prehoneycombcompat.scale_x); Proxy_properties.put ("ScaleY", prehoneycombcompat.scale_y); Proxy_properties.put ("Scrollx", prehoneycombcompat.scroll_x); Proxy_properties.put ("scrolly", prehoneycombcompat.scroll_y); Proxy_properties.put ("x", Prehoneycombcompat.x); Proxy_properties.put ("Y", prehoneycombcompat.y); }
The supported animated property names are the ones above
Animated instances that support moving up and down:
@Overrideprotected void Setupanimation (view view) {//TODO auto-generated Method Stub//getanimatorset (). Playtogether (/ /objectanimator.offloat (View, "Translationy", 0,-300). Setduration,//objectanimator.offloat (view, " Translationy ", -300,300). Setduration (+/);//getanimatorset (). Play (Objectanimator.offloat (View," Translationy " , 0,-300). Setduration () Getanimatorset (). playsequentially (Objectanimator.offloat (View, "Translationy", 0,-100 ). Setduration (+), objectanimator.offloat (view, "Translationy", -100,100). Setduration (800), Objectanimator.offloat (View, "Translationy", 100,-100). Setduration (+), objectanimator.offloat (View, " Translationy ", -100,100). Setduration (+), objectanimator.offloat (view," Translationy ", 100,0). Setduration (400));}
You can also use the following method:
@Override protected void setupanimation (view view) { getanimatorset (). Playtogether ( Objectanimator.offloat (View, "Translationy", 0,-100,-200,-300,-200,-100,0,100,200,300,200,100,0, -100,-200,- 300,-200,-100,0,100,200,300,200,100, 0). Setduration (4000), objectanimator.offloat (view, "Alpha", 1, 1). Setduration (MDURATION*3/2) ); }
The effect here is similar to the above effect, but it is here to split the whole distance, you can divide the time,
That means using
Playtogether This method can also implement <pre name= "code" class= "Java" >playsequentially the effect of this method. (Play animation queue, very good understanding)
title = (TextView) Findviewbyid (r.id.title); Final baseeffects animator = Effectstype.Slidetogether.getAnimator (); Final Handler Handler = new Handler (new Handler.callback () {@Overridepublic Boolean handlemessage (Message arg0) {//TODO A Uto-generated method Stubanimator.start (title); return true;}); New Thread (New Runnable () {@Overridepublic void Run () {//TODO auto-generated method Stubwhile (True) {try {thread.sleep (80 00);} catch (Interruptedexception e) {//TODO auto-generated catch Blocke.printstacktrace ();} Handler.sendemptymessage (0);}}). Start ();
Play an animation directly against a single view, such as.
The notes are made here first, and if there are any mistakes, please criticize them.
Write the Code,change the world!
Copy to Google TranslateTranslation Resultsplaysequentially
Notes on the open source Nineoldandroids compatible animations on GitHub