Code example for TranslateAnimation

Methods: setAnimationListener, setDuration, setInterpolator

0
		if(onoff){
			setVisibility(View.VISIBLE);
			animation = new TranslateAnimation(0.0f, 0.0f, this.height, 0.0f);
			this.active = true;
		} else { 
			animation = new TranslateAnimation(0.0f, 0.0f, this.height, 0.0f);
			animation.setAnimationListener(animListener);
			this.active = false;
		} 
		/** Amount of time (in milliseconds) for the animation to run */ 
		animation.setDuration(this.duration);
		/** Defines the interpolator used to smooth the animation movement in time.  
		 * An AccelerateInterpolator where the rate of change starts out slowly  
		 * and and then accelerates. */ 
		animation.setInterpolator(new AccelerateInterpolator(1.0f));
		startAnimation(animation);
	} 
	 
	/** 
	 * This method checks whether the expanded menu is activated or not, 
	 * and makes the appropriate switch.