我需要在标签中显示通知的数量。我如何在android中做到这一点。我的标签代码如下所示。
mTabHost = (FragmentTabHost)rootView.findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec("HOME").setIndicator("HOME"),
homepage.class, null);
mTabHost.addTab(mTabHost.newTabSpec("NOTIFICATIONS").setIndicator("NOTIFICATIONS"),
notificationfragment.class, null);
return rootView;
答案 0 :(得分:0)
您可以通过将其上的视图设置为 -
来自定义tabhosts Spec spec = tabHost.newTabSpec("groups");
View view = LayoutInflater.from(this).inflate(R.layout.tabwidget_tabs, tabHost.getTabWidget(), false);
spec.setIndicator(view);