Android电视关机动画
MainActivity
Java代码
package org.wp.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends Activity {
private ImageView myImageView = null;
private Button myButton = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myImageView = (ImageView) this.findViewById(R.id.myImageView);
myButton = (Button) this.findViewById(R.id.myButton);
myButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myImageView.startAnimation(new TVOffAnimation());
}
});
}
}
TVOffAnimation
Java代码
package org.wp.activity;
import android.graphics.Matrix;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.Transformation;
public class TVOffAnimation extends Animation {
/** 中心点X坐标 **/
private int centerX = 0;
/** 中心点Y坐标 **/
private int centerY = 0;
@Override
public void initialize(int width, int height, int parentWidth,
int parentHeight) {
// void setDuration (long durationMillis)
// Since: API Level 1 How long this animation should last.
// The duration cannot be negative.
setDuration(500);
// void setFillAfter(boolean fillAfter)
相关新闻>>
- 发表评论
-
- 最新评论 更多>>