Tablayout with icons only

后端 未结 12 1384
暗喜
暗喜 2020-12-04 11:32

I am using design support to create tabs. I am also using ViewPager for swipable tabs.

Now, I don\'t know how to use only icons instead of texts in tabs

12条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 11:41

    With the TabLayout provided by the Material Components Library you can use:

    • the method setIcon to define the resourceId
    • the method setTabLabelVisibility to set the TAB_LABEL_VISIBILITY_UNLABELED.

    Something like:

    for (int i=0;i

提交回复
热议问题