tab layout to have horizontal scroll with only 2 tabs per screen code example
Example: tablayout horizontal scroll
In Java:
tabLayout.setTabMode(MODE_SCROLLABLE) // Default is MODE_FIXED
In XML:
app:tabMode="scrollable"
In Java:
tabLayout.setTabMode(MODE_SCROLLABLE) // Default is MODE_FIXED
In XML:
app:tabMode="scrollable"