This is a little bit of a demand, but still do it, the effect is as follows, this time to talk about, a little complex, after their own estimates have forgotten, record a--!
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/8F/wKioL1WgrsyzF6XNAAUkmqxf620596.gif "title=" F.gif " alt= "Wkiol1wgrsyzf6xnaaukmqxf620596.gif"/>
Animation class Animalutul:
public class animalutul {private animatorset manimatorset; relativelayout rl_parent;private imageview iv_logo;private float mlogoy;private Context context;private long starttime = 1500;public long getstarttime () {return starttime;} Public void setstarttime (Long starttime) {this.starttime = starttime;} Public animalutul (Context context, relativelayout layout, imageview logo) { Iv_logo = logo;rl_parent = layout;this.context = context;iv_logo.postdelayed (New runnable () {@Overridepublic void run () {if (mlogoy == 0) {mlogoy = viewhelper.gety (Iv_logo);} Playlogoinanim ();}}, starttime) iv_logo.postdelayed (new runnable () {@Overridepublic void run () {playinanim ();}}, starttime);} Public void playinanim () {Rl_parent.setvisibility (view.visible); Animatorset manimatorset;objectanimator anim3 = objectanimator.offloat (rl_parent, "Y" , Displayutil.getdisplayheightpixels (context), displayutil.dip2px (context, 160));manimatorset = New animatorset (); Manimatorset.play (ANIM3); manimatorset.setduration (+); Manimatorset.start ();} Private void playlogoinanim () {objectanimator anim1 = objectanimator.offloat (iv_ logo, "ScaleX", 1.0f,0.5f); Objectanimator anim2 = objectanimator.offloat (Iv_logo, "ScaleY", 1.0f,0.5f) objectanimator anim3 = objectanimator.offloat (iv_logo, "Y") , mlogoy,displayutil.dip2px (context, 15));if (manimatorset != null && manimatorset.isrunning ()) {manimatorset.cancel (); manimatorset = null;} Manimatorset = new animatorset (); Manimatorset.play (ANIM1). with (ANIM2); Manimatorset.play (ANIM2). With (ANIm3); manimatorset.setduration (+); Manimatorset.start ();}}
fit Screen height class Displayutil:
public class displayutil { /** Screen Width */ private static int displaywidthpixels = 0; /** Screen Height */ private static int displayheightpixels = 0; /** * Get screen parameters * @param context */ private static void getdisplaymetrics (Context context) { Displaymetrics dm = new displaymetrics (); ( (Activity) context). Getwindowmanager (). Getdefaultdisplay (). Getmetrics (DM); // width DisplayWidthPixels = Dm.widthpixels; // Height displayheightpixels = dm.heightpixels; } /** * Get screen width * @param context * @return */ public static int getdisplaywidthpixels (Context context) { if (context == null) { return -1; } if (displaywidthpixels == 0) { getdisplaymetrics (context); } return displaywidthpixels; } /** * Get screen height * @param context * @return */ public static int Getdisplayheightpixels (Context context) { if ( Context == null) { return -1; } if (displayheightpixels == 0) { getdisplaymetrics (context); } return DisplayheightPixels; } /** * Convert PX values to dip or DP values * * @param pxvalue * @return */ Public static int px2dip (Context context, float pxvalue) { final float scale = context.getresources (). Getdisplaymetrics () .density; return (int) (pxValue / scale + 0.5f); } /** * convert dip or DP values to PX values * * @ param dipvalue * @return */   PUBLIC STATIC INT DIP2PX (Context context, float dipvalue) { Final float scale = context.getresources (). Getdisplaymetrics () .density; return (int) (dipvalue * scale + 0.5f); } /** * convert PX value to SP value * * @param pxValue * @return */ public static int PX2SP (Context context, float pxvalue) { Final float fontscale = context.getresources (). Getdisplaymetrics () .scaledDensity; return (int) (pxvalue / fontscale + 0.5f); } /** * Convert SP value to PX value *&nbSP; @param spValue * @return */   PUBLIC STATIC INT SP2PX (Context context, float spvalue) { final float fontscale = context.getresources (). Getdisplaymetrics () .scaleddensity; return (int) ( spvalue * fontscale + 0.5f); }}
Calling method: New Animalutul (This, the Layout,logo image that appears );
Oh ~ so tired ~ every day write these--!
This article is from the "Liangxiao Technology Center" blog, please be sure to keep this source http://liangxiao.blog.51cto.com/3626612/1673192
Android phase 44th-Animation of the login screen