android tabhost从另一个选项卡向该选项卡添加视图

问题描述

| 我需要与android tabhost相关的一点帮助。我有3个标签和3个活动。 MainTab活动是“来自TabActivity的扩展”,而其他2个活动是“来自Activity的扩展”。 在MainTab活动中,有两个按钮Radio和CheckBox,当用户单击单选按钮时,我想在tab2中显示单选按钮视图。当用户单击复选框时,我要显示复选框视图。可以给我一个想法,我如何实现这一目标吗?下面是我的代码。
    public class MainTabHost extends TabActivity  implements OnTabChangeListener{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.homeui);

    TabHost tabHost = getTabHost(); 
    tabHost.setOnTabChangedListener(this);

    TabHost.TabSpec spec;  
    Intent intent; 

    intent = new Intent().setClass(this,Main.class);        
    spec = tabHost.newTabSpec(\"Main Tab\").
    setIndicator(\"Main Tab\")
                  .setContent(intent);
    spec.setIndicator(\"\",this.getResources().getDrawable(R.drawable.maintabicon) );
    tabHost.addTab(spec);

    intent = new Intent().setClass(this,TabA.class);
    spec = tabHost.newTabSpec(\"Tab A\").
    setIndicator(\"Tab A\")
                  .setContent(intent);
    spec.setIndicator(\"\",this.getResources().getDrawable(R.drawable.tabaicon) );
    tabHost.addTab(spec);


    tabHost.setCurrentTab(0);       

}

@Override
public void onTabChanged(String tabId) {

}
}     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)