I have added TabLayout (from support library v22.2.1) to my Fragment as:
TabLayout
Here's an easier way to make sure that the width of tab is equal to tab's string length
Following code is used:-
app:tabMaxWidth="0dp" app:tabMode="scrollable"