Code example for ScaleAnimation

Methods: setDuration, setFillAfter, startNow

0
    		@Override 
			public void onClick(View arg0) {
				// TODO Auto-generated method stub 
				if(i==1){
			 
				final ScaleAnimation animation =new ScaleAnimation(1f, 1f, 1f, 0f, 
						Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); 
						animation.setDuration(1000);//设置动画持续时间 
						/** 常用方法 */  
						//animation.setRepeatCount(int repeatCount);//设置重复次数  
						animation.setFillAfter(true);//动画执行完后是否停留在执行完的状态 
				ll.setAnimation(animation); 
				/** 开始动画 */  
				animation.startNow(); 
				i=2;
				}else{	 
					ll.setVisibility(View.VISIBLE);
					//实现 
					final ScaleAnimation animation =new ScaleAnimation(1f, 1f, 0f, 1f, 
							Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0f); 
							animation.setDuration(1000);//设置动画持续时间