Tween Animation
1. When the TV is turned off, there is a white bar in the middle of the TV to close instantly.
To achieve this effect is to use the tween animation to achieve.
The XML file for the animation is:
Android:startoffset= "" Use this property to achieve the order of animation execution
1 <?XML version= "1.0" encoding= "Utf-8"?>2 <Setxmlns:android= "Http://schemas.android.com/apk/res/android"3 Android:shareinterpolator= "false" 4 android:zadjustment= "Top" >5 6 < Scale7 android:duration= "the"8 Android:fromxscale= "1.0"9 Android:fromyscale= "1.0"Ten Android:interpolator= "@android: Anim/accelerate_interpolator" One Android:pivotx= "50%" A Android:pivoty= "50%" - Android:toxscale= "1.0" - Android:toyscale= "0.003" /> the < Scale - android:duration= " the" - Android:fromxscale= "1.0" - Android:fromyscale= "1.0" + Android:interpolator= "@android: Anim/accelerate_interpolator" - Android:pivotx= "50%" + Android:pivoty= "50%" A Android:startoffset= "the" at Android:toxscale= "0.0" - Android:toyscale= "0.3" /> - - <Alpha - android:duration= " the" - Android:fillafter= "true" in android:fillenabled= "true" - Android:fromalpha= "1.0" to Android:interpolator= "@android: Anim/accelerate_interpolator" + Android:startoffset= "the" - Android:toalpha= "0" /> the * <Rotate $ android:fromdegrees= "0.0"Panax Notoginseng android:todegrees= "360.0" - Android:pivotx= "50%" the Android:pivoty= "50%" + Android:fillafter= "true" A Android:interpolator= "@android: Anim/linear_interpolator" the android:duration= "the" + /> - $ </Set>
Activity on the main interface
1 Public classMainactivityextendsActivity {2 3 PrivateImageView, line;4 5 PrivateAnimation manimation;6 @Override7 protected voidonCreate (Bundle savedinstancestate) {8 Super. OnCreate (savedinstancestate);9 Setcontentview (r.layout.activity_main);Ten Initview (); One } A - Private voidInitview () { -back =(ImageView) Findviewbyid (r.id.img_back); theline =(ImageView) Findviewbyid (r.id.img_line); -Manimation = Animationutils.loadanimation (mainactivity. This, R.anim.tv_off); -Manimation.setanimationlistener (NewAnimationlistener () { - + @Override - Public voidOnanimationstart (Animation Animation) { + A } at - @Override - Public voidonanimationrepeat (Animation Animation) { - - } - in @Override - Public voidonanimationend (Animation Animation) { to + } - }); the * line.setvisibility (view.visible); $ line.setanimation (manimation);Panax Notoginseng //Manimation.start (); - the } + A the}
activity_main.xml:
1 <Framelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 Tools:context=". Mainactivity " >6 7 <ImageView8 Android:id= "@+id/img_back"9 Android:layout_width= "Match_parent"Ten Android:layout_height= "Match_parent" One Android:background= "@color/black" /> A - <ImageView - Android:id= "@+id/img_line" the Android:layout_width= "Match_parent" - Android:layout_height= "Match_parent" - Android:background= "@color/white" - android:visibility= "Gone" + /> - + </Framelayout>
SOURCE download
Android Mimic TV off interface