Android - what is the right way to implement a wizard with animation between steps

I am creating an Android application that needs to go through steps like the wizard.

Current structure:

At the moment, I use one action with a separate view.xml for each step, then I use setContentView(activeStep)to display the active step.

I ran into some difficulties trying to revive the steps. I used the following code:

LayoutInflater inflater = getLayoutInflater();
View view = inflater.inflate(activeStep, null, false);
view.startAnimation(AnimationUtils.loadAnimation(activity, R.anim.slide_in));
setContentView(view);

Result: the first performance has disappeared, and the new one is animated, not a smooth transition.

My goal is to revive both views, one of them will bring out the other.

Question: Is it possible to do this with my current structure (reminder: one action, many views), or should I consider each step as a separate view?

+5
2

, , :

private static ViewAnimator viewAnimator;

 public void onCreate(Bundle savedInstanceState) {
        viewAnimator = new ViewAnimator(this);
        View step1 = View.inflate(activity, R.layout.step_1, null);
        View step2 = View.inflate(activity, R.layout.step_2, null);
        View step3 = View.inflate(activity, R.layout.step_3, null);
        viewAnimator.addView(step1);
        viewAnimator.addView(step2);
        viewAnimator.addView(step3);
        viewAnimator.setInAnimation(activity, R.anim.slide_in);
        viewAnimator.setOutAnimation(activity, R.anim.slide_out);
        setContentView(viewAnimator);
    }

viewAnimator.showNext() viewAnimator.showPrevious() ViewSwitcher , 2

+3

, Activity View, .

, setContentView . , , hide unhide , .

0

All Articles