import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
public class dash1 extends Activity {
ImageView img,img1;
Animation an,an1,an2,an3;Button bt,bt2,bt3,bt4;
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
img = (ImageView)findViewById(R.id.ImageView01);
final Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.minute);
final int w= bmp.getWidth();
final int h= bmp.getHeight();
final Matrix mat = new Matrix();
mat.postRotate(180);
Bitmap rtd = Bitmap.createBitmap(bmp, 0, 0, w, h, mat, true);
BitmapDrawable bmd = new BitmapDrawable(rtd);
img.setImageDrawable(bmd);
an = AnimationUtils.loadAnimation(this, R.anim.anim);
an1 = AnimationUtils.loadAnimation(this, R.anim.anim1);
an2 = AnimationUtils.loadAnimation(this, R.anim.anim2);
an3 = AnimationUtils.loadAnimation(this, R.anim.anim3);
bt = (Button)findViewById(R.id.Button01);
bt2 = (Button)findViewById(R.id.Button02);
bt3 = (Button)findViewById(R.id.Button03);
bt4 = (Button)findViewById(R.id.Button04);
bt.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
an.setFillAfter(true);
img.startAnimation(an);
return false;
}
});
bt2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
img.startAnimation(an1);
}
});
bt3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
an2.setFillAfter(true);
img.startAnimation(an2);
}
});
bt4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
an3.setFillAfter(true);
img.startAnimation(an3);
}
});
}
}
156

被折叠的 条评论
为什么被折叠?



