Search code examples
androidxmllayoutviewflipper

How do I view a different flipper in Layout view of an xml?


Hey all - I am using a flipper in my main xml file to view multiple layouts in my app.

For instance, if something = 1, the user is shown one version of the flipper, where if something = 2 the user sees a different version.

Is there a way I can view the layout of the xml file for the other flippers I have rather than the main one? Ie, is there a way to switch views of each state of the flipper in eclipse?

Thanks!


Solution

  • I would suggest including all flippers in your xml file. Use android:visibility="gone" for the flippers that won't show by default, or all of them. Then in your code you can toggle them back on with flipper.setVisibility(View.VISIBLE). The others should View.GONE.

    For a cleaner XML file (especially if you have a lot of flippers), you can use <include> statements to each flipper source.