How to set icon next to text in tablayout
It's easy.
Tab tab = tabLayout.newTab();
tab.setCustomLayout( R.layout.whatever );
tabLayout.addTab(add);
Your layout would be a simple TextView
with a drawableRight
that specifies your icon.
For more: http://panavtec.me/playing-with-the-new-support-tablayout/
Another solution is setting the app:tabInlineLabel="true"
in your activity .xml or call the TabLayout method setInlineLabel(true)
.
Source