-2

I am using SlidingTabLayout provided by Google but i dont know how to add badge on top of tab's text like in this screenshot below. Any help would be appreciated alot.

I have already done showing text and icon image both side by side but i dont how to show notification like overlay text. As you can see in this image notification text is over the icon image.

enter image description here

Kapil
  • 1,790
  • 1
  • 16
  • 32

2 Answers2

0

View target = findViewById(R.id.target_view);

BadgeView badge = new BadgeView(this, target);

badge.setText("1");

badge.show();

Go to Here

https://github.com/jgilfelt/android-viewbadger

Drim
  • 514
  • 5
  • 18
0

As you can find here , user Nikola Despotoski already answered on your question.

Use

mSlidingTabLayout.setCustomTabView(int layoutResId, int textViewId)

to inflate a custom layout for the SlidingTabLayout tab views.

When SlidingTabLayout tries to populate the tab strips, initially looks for any specified layout resource to inflate. Otherwise, it inflates default tab view.

Community
  • 1
  • 1
Anton A.
  • 1,718
  • 15
  • 37
  • i used this to show image and text side by side but i am not sure how can i use it to show overlay text on image – Kapil Jun 30 '15 at 12:07
  • @Aditya Try [this](https://gist.github.com/anonymous/3c04512ffc74a28a19e4). I found it on the web. – Anton A. Jun 30 '15 at 12:09
  • @Aditya What is problem with that icon. You inflate your own layout, so you can put there anything – Anton A. Jun 30 '15 at 12:10