属性动画用法小例子

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;

import android.animation.AnimatorSet;

public void moveUpAnimation(){
        movedToUpFlag = true;
doneBtn.setVisibility(View.INVISIBLE);
        RelativeLayout recoder_rl = (RelativeLayout)findViewById(R.id.recoder_rl);
ObjectAnimator oa=ObjectAnimator.ofFloat(recoder_rl, "y", -240);
oa.setDuration(500);
VUMeter uvMeter = (VUMeter)findViewById(R.id.uvMeter);
ObjectAnimator oa2=ObjectAnimator.ofFloat(uvMeter, "y", -340);
oa2.setDuration(500);
        RelativeLayout timerViewLayout = (RelativeLayout)findViewById(R.id.timerViewLayout);
ObjectAnimator oa3=ObjectAnimator.ofFloat(timerViewLayout, "y", -240);
oa3.setDuration(500);
LinearLayout turn_onoff_lv = (LinearLayout)findViewById(R.id.turn_onoff_lv);
ObjectAnimator oa4=ObjectAnimator.ofFloat(turn_onoff_lv, "y", 85);
oa4.setDuration(500);

final RelativeLayout filelistview = (RelativeLayout)findViewById(R.id.filelist_fragment);
ObjectAnimator oa5=ObjectAnimator.ofFloat(filelistview, "y", 205);
oa5.addUpdateListener(new AnimatorUpdateListener() {
                public void onAnimationUpdate(ValueAnimator animation) {


     filelistview.getLayoutParams().height =612;


                   filelistview. requestLayout();
                }
            });


        oa5.setDuration(500);
        AnimatorSet animSetY = new AnimatorSet();
animSetY.playTogether(oa, oa2,oa3,oa4,oa5);
        animSetY.start();        


    }

你可能感兴趣的:(属性动画用法小例子)