androidandroid-actionbarswipeandroid-tabsandroid-scrollable-tabs

Can I embed scrollable tabs inside the action bar?


I'd like to have a layout where screen real estate is important on smaller screens, but I'd like users to be able to swipe between exactly two tabs. On these smaller screened devices, I don't want to waste an entire row with a scrollable tab widget like this:

scrollable tabs

but fixed tabs offer no indication to users that they can swipe:

fixed tabs

Users will typically need to view both tabs to complete the task. Is there any way presently to embed tabs with support for "swipe to switch tabs" inside the main action bar?


Solution

  • Not only is it possible to support swiping with standard action bar fixed tabs, it's a design guideline:

    Use fixed tabs to support quick changes between two or three app views. Fixed tabs should always allow the user to navigate between the views by swiping left or right on the content area.

    enter image description here

    Scrollable tabs are different than fixed tabs in that the tab bar itself can be scrolled to see more tabs than will fit on the given display:

    enter image description here