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
I would suggest you look at this website:
https://guides.codepath.com/android/Google-Play-Style-Tabs-using-TabLayout#design-support-library
You can iterate through the different tabs using this method and set the custom views to whatever you want:
// Iterate over all tabs and set the custom view
for (int i = 0; i < tabLayout.getTabCount(); i++) {
TabLayout.Tab tab = tabLayout.getTabAt(i);
tab.setCustomView(pagerAdapter.getTabView(i));
}
public View getTabView(int position) {
// Given you have a custom layout in `res/layout/custom_tab.xml` with a TextView and ImageView
View v = LayoutInflater.from(context).inflate(R.layout.custom_tab, null);
TextView tv = (TextView) v.findViewById(R.id.textView);
tv.setText(tabTitles[position]);
ImageView img = (ImageView) v.findViewById(R.id.imgView);
img.setImageResource(imageResId[position]);
return v;
}
}