I have setup tabs as UPDATE 29/05/2015 this post. Tabs take full width on my Nexus 4 mobile but on nexus 7 tablet it in center and not cover full screen wid
In my variant of this problem, I had 3 tabs of moderate size which weren't taking up full width on tablets. I didn't need the tabs to be scrollable on tablets, since tablets are big enough to display the tabs all together without any scrolling. But I did need the tabs to be scrollable on phones, since phones are too small to display all the tabs together.
The best solution in my case was to add a res/layout-sw600dp/main_activity.xml
file, where the relevant TabLayout could have app:tabGravity="fill"
and app:tabMode="fixed"
. But in my regular res/layout/main_activity.xml
, I left out app:tabGravity="fill"
and app:tabMode="fixed"
, and had app:tabMode="scrollable"
instead.