如何在tabhost android中添加徽章计数器
我需要在选项卡中显示通知的数量。我如何在安卓系统中做到这一点。我的选项卡代码如下所示如何在tabhost android中添加徽章计数器,android,android-layout,android-fragments,android-activity,Android,Android Layout,Android Fragments,Android Activity,我需要在选项卡中显示通知的数量。我如何在安卓系统中做到这一点。我的选项卡代码如下所示 mTabHost = (FragmentTabHost)rootView.findViewById(android.R.id.tabhost); mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent); mTabHost.addTab(mTabHost.newTabSpec("HOME"
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;
通过将tabhosts规范上的视图设置为-
spec = tabHost.newTabSpec("groups");
View view = LayoutInflater.from(this).inflate(R.layout.tabwidget_tabs, tabHost.getTabWidget(), false);
spec.setIndicator(view);
R.layout.tabwidget\u tabs中应该有什么?这是tabItem.View=LayoutInflater.from(getApplicationContext())的布局。充气(R.layout.tab\u layout,null);TextView tv_计数器=(TextView)view.findViewById(R.id.tab_计数器);BadgeView badge=新的BadgeView(此,电视台);徽章.setText(“6”);徽章显示();这是我必须在选项卡中显示徽章的代码。如何从其他类更新徽章?