-1
我需要在選項卡中顯示通知的數量。我如何在android中做到這一點。我的標籤代碼如下所示。如何在tabhost中添加徽章計數器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;
應該是什麼那裏R.layout.tabwidget_tabs? – user1455450
這是tabItem的佈局。 –
View view = LayoutInflater.from(getApplicationContext())。inflate(R.layout.tab_layout,null); TextView tv_counter =(TextView)view.findViewById(R.id.tab_counter); BadgeView badge = new BadgeView(this,tv_counter); badge.setText(「6」); badge.show();這是我必須在標籤中顯示徽章的代碼。我如何更新其他課程的徽章? – user1455450