Search code examples
androidandroid-fragmentslandscapepreferenceactivity

PreferenceFragment plus headers when in landscape mode


how can I configure a preference activity to automatically show preference headers on the left and the details of the selected header on the right? Can you point me to some docs? Thanks in advance!


Solution

  • From the documentation,

    This activity shows one or more headers of preferences, each of which is associated with a PreferenceFragment to display the preferences of that header. The actual layout and display of these associations can however vary; currently there are two major approaches it may take:

    On a small screen it may display only the headers as a single list when first launched. Selecting one of the header items will re-launch the activity with it only showing the PreferenceFragment of that header. On a large screen in may display both the headers and current PreferenceFragment together as panes. Selecting a header item switches to showing the correct PreferenceFragment for that item.

    Thus, the behavior you are describing is automatically supported on large screen tablets running Android 3.0+.