I’m trying to add an animation to my TabActivty. For example, when the user select the 2nd tab, I want the new activity comes from the right. When the user select the first tab, I want the activity comes from the left.
I’ve found how to add one animation, but I want to add one again. Here is the code I’m using:
public Animation inFromRightAnimation()
{
Animation inFromRight = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, +1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
inFromRight.setDuration(240);
inFromRight.setInterpolator(new AccelerateInterpolator());
return inFromRight;
}
And
getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId)
{
View currentView = getTabHost().getCurrentView();
currentView.setAnimation( inFromRightAnimation() );
}
});
How can I do that?
Thanks.
Regards.
V.
This works correctly:
And the animations: