Code example for TranslateAnimation

Methods: setDuration, setFillAfter, setStartTime

0
		handlein.setOnClickListener(new View.OnClickListener() { 
 
			public void onClick(View v) {
				// TODO Auto-generated method stub 
				AnimationSet Close = new AnimationSet(true);
				Animation animHandleClose = new TranslateAnimation(
						Animation.RELATIVE_TO_PARENT, handle.getX(),
						Animation.RELATIVE_TO_PARENT, -panel.getWidth(),
						Animation.RELATIVE_TO_PARENT, 0.0f,
						Animation.RELATIVE_TO_PARENT, 0.0f);
				animHandleClose.setDuration(2000);
				animHandleClose.setFillAfter(true);
				// animation.setRepeatMode(Animation.RESTART); 
 
				// AnimationSet setPanelClose = new AnimationSet (true); 
				Animation animPanelClose = new TranslateAnimation(
						Animation.RELATIVE_TO_PARENT, panel.getX(),
						Animation.RELATIVE_TO_PARENT, -panel.getWidth(),
						Animation.RELATIVE_TO_PARENT, 0.0f,
						Animation.RELATIVE_TO_PARENT, 0.0f);
				animPanelClose.setDuration(2000);
				animPanelClose.setFillAfter(true);
				// animation.setRepeatMode(Animation.RESTART); 
 
				long timeClose = AnimationUtils.currentAnimationTimeMillis();
				animHandleClose.setStartTime(timeClose);
				animPanelClose.setStartTime(timeClose);
 
				Close.addAnimation(animPanelClose);
				Close.addAnimation(animHandleClose);