publicclassMainActivityextendsActivity{Buttonbutton1,button2,button3,button4,button5,button6,button7;TranslateAnimationup_down;TranslateAnimationdown_up;TranslateAnimationleft_right;TranslateAnimationright_left;AlphaAnimationhave_not;ScaleAnimationsmall_big;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);button1=(Button)findViewById(R.id.button1);button2=(Button)findViewById(R.id.button2);button3=(Button)findViewById(R.id.button3);button4=(Button)findViewById(R.id.button4);button5=(Button)findViewById(R.id.button5);button6=(Button)findViewById(R.id.button6);button7=(Button)findViewById(R.id.button7);up_down=newTranslateAnimation(Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,-1.0f,Animation.RELATIVE_TO_SELF,0.0f);up_down.setDuration(500);down_up=newTranslateAnimation(Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,1.0f,Animation.RELATIVE_TO_SELF,0.0f);down_up.setDuration(500);left_right=newTranslateAnimation(Animation.RELATIVE_TO_SELF,-1.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f);left_right.setDuration(500);right_left=newTranslateAnimation(Animation.RELATIVE_TO_SELF,1.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f);right_left.setDuration(500);have_not=newAlphaAnimation(1,0);have_not.setFillAfter(true);have_not.setDuration(500);small_big=newScaleAnimation(0,1,0,1,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);small_big.setDuration(500);button5.setOnClickListener(newOnClickListener(){@OverridepublicvoidonClick(Viewv){button1.startAnimation(up_down);button2.startAnimation(left_right);button3.startAnimation(right_left);button4.startAnimation(down_up);button6.startAnimation(small_big);button7.startAnimation(have_not);}});}}