In your xml layout file, you'll want something like the followng…
… This defines a ViewSwitcher which slides the next View to be shown in from the left and slides the current View out to the right.
In your code then where this layout file is referenced, you can initialise your Views as follows...
ViewSwitcher viewSwitcher =
View myFirstView = findViewById(R.id.myFirstView);
View mySecondView = findViewById(R.id.mySecondView);
… And define some helper methods like the following to toggle between the two Views…
if (viewSwitcher.getCurrentView() != myFirstView)
if (viewSwitcher.getCurrentView() != mySecondView)
Done! And I guess the above applies equal well for ViewFlipper too.
Other animations are available too like fading in and fading out. Check out the following reference: