Tablayout with icons only

后端 未结 12 1390
暗喜
暗喜 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:46

    In TabLayout, setting icon is easy:

    getPageTitle(position) should return null (if you don't want title to show).

    Next :

    tabLayout.getTabAt(0).setIcon(resId);
    
    tabLayout.getTabAt(1).setIcon(resId);
    
    ......
    

提交回复
热议问题