Android Tablayout tabs with notification badge like whatsApp

前端 未结 9 956
感情败类
感情败类 2020-12-04 20:15

I want to implement notification badge with android.support.design.widget.TabLayout. I had tried my best effort to implement it but fails.

Any help wou

相关标签:
9条回答
  • 2020-12-04 20:53

    I will use this:

      tabLayout.getTabAt(0).getOrCreateBadge().setNumber(10);
    
    0 讨论(0)
  • 2020-12-04 20:54

    I suggest use a CustomView for tabs. you can create a new view with badge and set that to your tabs.

    tab.setCustomView(R.layout.badged_tab);
    
    0 讨论(0)
  • 2020-12-04 20:56

    There are easy way as well. Just append a special characters behind. It will look like whatsapp does.

    ➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈ ➉ ➊ ➋ ➌ ➍ ➎ ➏ ➐ ➑ ➒ ➓

    tabLayout.addTab(tabLayout.newTab().setText("News " + ➊));
    
    0 讨论(0)
提交回复
热议问题