One of the android special effects, TV disable Special Effects

Source: Internet
Author: User

Code: 1. Code of the Activity to be closed: [java] <span style = "font-size: 18px; "> public class TVOffDemo extends Activity {/** Called when the activity is first created. */public void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. main); Button B = (Button) findViewById (R. id. button01); B. setOnClickListener (new OnClickListener () {public void onClick (View v) {Vie W img = findViewById (R. id. layout); img. startAnimation (new TVOffAnimation () ;}}</span> [java] <span style = "font-size: 18px; "> 2. animation implementation class TVOffAnimation </span> [java] view plaincopyprint? <Span style = "font-size: 18px;"> public class TVOffAnimation extends Animation {private int halfWidth; private int halfHeight; public void initialize (int width, int height, int parentWidth, int parentHeight) {super. initialize (width, height, parentWidth, parentHeight); setDuration (500); setFillAfter (true); // Save the center of the View halfWidth = width/2; halfHeight = height/2; setInterpolator (new AccelerateDecelerateInterpolator ();} protected void applyTransformation (float interpolatedTime, Transformation t) {final Matrix matrix = t. getMatrix (); if (interpolatedTime <0.8) {matrix. preScale (1 + 0.625f * interpolatedTime, 1-interpolatedTime/0.8f + 0.01f, halfWidth, halfHeight);} else {matrix. preScale (7.5f * (1-interpolatedTime), 0.01f, halfWidth, halfHeight) ;}}</span>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.