I have a problem, I'm trying to make child in ViewAnimator, which will slide from bottom. And after back press, it will slide down again.
Animation anim = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
anim.setDuration(350);
anim.setInterpolator(new AccelerateInterpolator());
viewFlipper.setInAnimation(anim);
viewFlipper.setOutAnimation(null);
viewFlipper.setDisplayedChild(2);
onBackPress:
Animation anim = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 1.0f
);
anim.setDuration(350);
anim.setInterpolator(new AccelerateInterpolator());
viewFlipper.setInAnimation(null);
viewFlipper.setOutAnimation(anim);
viewFlipper.setDisplayedChild(0);
But my problem is that when I click on button the first time, the Screen goes black and Child slides up. When I click on back button, everything is ok. (child slides down and behind is first screen...
Any help?
EDIT:
Animation inAnim = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 1.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
anim.setDuration(350);
anim.setInterpolator(new AccelerateInterpolator());
Animation outAnim = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f
);
outAnim.setDuration(350);
outAnim.setInterpolator(new AccelerateInterpolator());
viewFlipper.setInAnimation(inAnim);
viewFlipper.setOutAnimation(outAnim);
viewFlipper.setDisplayedChild(2);