不用XML,代码实现,谢谢

解决方案 »

  1.   

    package com.karl;import android.app.Activity;
    import android.os.Bundle;
    import android.view.MotionEvent;
    import android.view.animation.AccelerateDecelerateInterpolator;
    import android.view.animation.Animation;
    import android.view.animation.ScaleAnimation;public class TestAnimation extends Activity {
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    } public void startAnimation() {
    Animation anim = null;
    // anim = new RotateAnimation(0.0f, +360.0f);
    // anim = new ScaleAnimation(1.0f, 2.0f, 1.0f, 2.0f, 0.5f, 0.5f);
    anim = new ScaleAnimation(1.0f, 1.4f, 1.0f, 1.4f, 
                 Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    anim.setInterpolator(new AccelerateDecelerateInterpolator());
    anim.setDuration(3000);
    findViewById(R.id.textView).startAnimation(anim);
    } @Override
    public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
    startAnimation();
    break;
    }
    return true;
    }
    }很久以前写的了 自己看看
      

  2.   


    大哥 自己看下代码好不
    // anim = new RotateAnimation(0.0f, +360.0f);
    这个被注释掉了
    这个是包含3中animation的例子
      

  3.   

    如何用RotateAnimation实现绕Y轴旋转sorry 才反应过来
    被你的题目弄迷糊了
    因为绕Y轴旋转是类似3维的 所以RotateAnimation不行(至少我不知道怎么实现)要想实现绕Y轴旋转,那用android.graphics.Camera
      

  4.   

    我也想遇到这个问题,有会的帮忙解答一下,用xml也可以。