user6419910 user6419910 - 6 months ago 21
Android Question

Setting width of tabs in

I am using tabs for my Viewpager, and this is the XML right now:


They look great but I want to be able to have more tabs and not have everything squish on the screen. However I don't like switching to scrollable tabMode because then everything flattens out and looks messy. How can I set the width of the individual tabs?

Answer Source

TabLayout does not provide the attributes for particular tab's fixed width. But you can set min and max width.

tabMinWidth and tabMaxWidth