Search code examples
androidandroid-layoutandroid-dialogfragment

How to create a DialogFragment layout with multiple pages or tabs


In my application, I want to implement a dialog fragment in which the user configures 1 to 4 sets of data (for lack of a better phrase). The number of "pages" to be set up is up to the user, so I would like the dialog fragment display to respond dynamically to the number requested by the user, by varying the number of viewable "screens".

My first thought was to implement a tabbed display with the tabs displayed or hidden as requested, but the way Android seems to think about tabs seems to be way more complicated than this. (Like this over-the-top example: How to create an Android Tabbed Dialog containing fragments?)

Is there a simple layout technique I'm missing that I could use for this? Perhaps a nice example somewhere on the web??


Solution

  • I think you can try and use a ViewPager - http://developer.android.com/training/animation/screen-slide.html

    It supports sliding pages in both directions. You can add custom animation to it - using buttons or whatever views to achieve the desired effect.