TabLayout creates the tabs in an opaque, non-extensible way and there is no way to provide a custom view at creation time, you have to hack around it with an observer set on the content source (e.g., a ViewPager adapter) and then use setCustomView() on each tab, after they're created.
Besides, the way tabs' views are created prevents libraries such as Calligraphy from correctly applying a typeface to the default tab views, because the TextAppearance is applied only after inflating the view, and there's no way to access the tabs pool nor any hook into the creation of new tabs.
Have a mechanism to create and bind the tabs' views, similar to list adapters, that have a createTabView() and a bindTabView() methods. The default implementation would simply retain the current behaviour; users could extend the default implementation to tweak the tabs' appearance (e.g., CalligraphyUtils.applyFontToTextView(tabTextView, typeface);) or to inflate their custom tab views without the waste of always inflating the default layout anyways.
It's been two years, are there any updates on this?
Most helpful comment
It's been two years, are there any updates on this?