0
我有一个Tab
,它具有包含TextView
的自定义布局。 我需要稍后从实际的选项卡子中更新该文本。编辑自定义选项卡的文本
下面是我在TabActivity
private void setupTab(final String tag) {
//Call createTabView() to give the tab a layout with some text
View tabview = createTabView(mTabHost.getContext(), tag);
Intent intent = new Intent().setClass(this, MyActivity.class);
TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(intent);
mTabHost.addTab(setContent);
mTabList.add(setContent);
}
private View createTabView(final Context context, final String text) {
View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
TextView tv = (TextView) view.findViewById(R.id.tabsText);
tv.setText(text); //we set the text of the tab here.
LinearLayout tvX = (LinearLayout) view.findViewById(R.id.tabsLayout);
return view;
}
设定,让有我如何设置它。现在,在孩子选项卡的活动,我需要它来更新文本...我想如果我没有自定义选项卡下面会工作......
((TabActivity)getParent()).getTabHost().setTag(((TabActivity)getParent()).getTabHost().getCurrentTab(), "new text");
但我需要自定义选项卡:)
没有人有任何意见或建议? 谢谢