See this simple example android.widget.ViewFlipper . With it, you can create various layouts from xml and then switch between them in a simple way:
ViewFlipper viewFlipper = (ViewFlipper) findViewById(R.id.myViewFlipper); // you can switch between next and previous layout and display it viewFlipper.showNext(); viewFlipper.showPrevious(); // or you can switch selecting the layout that you want to display viewFlipper.setDisplayedChild(1); viewFlipper.setDisplayedChild(viewFlipper.indexOfChild(findViewById(R.id.secondLayout)
Xml example with tree layouts:
<ViewFlipper android:id="@+id/myViewFlipper" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/firstLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > [...] </LinearLayout> <LinearLayout android:id="@+id/secondLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > [...] </LinearLayout> <LinearLayout android:id="@+id/thirdLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > [...] </LinearLayout> </ViewFlipper>
lory105 Jul 15 '13 at 7:33 2013-07-15 07:33
source share