How to set icon next to text in tablayout

后端 未结 2 1240
傲寒
傲寒 2021-01-12 07:52

I am working on Tablayout with text and icon from the following tutorial ..

My question is how to make the icon placed next to the text instead of above them? I am n

相关标签:
2条回答
  • 2021-01-12 08:20

    Another solution is setting the app:tabInlineLabel="true" in your activity .xml or call the TabLayout method setInlineLabel(true).

    Source

    0 讨论(0)
  • 2021-01-12 08:41

    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/

    0 讨论(0)
提交回复
热议问题