刷新没有意图的Android标签

时间:2012-10-19 12:42:57

标签: android tabs android-tabhost

请问如何在不添加意图的情况下刷新选项卡2(标记2,实时博客)的内容。

TabHost th =(TabHost)findViewById(R.id.tabhost1);         th.setup();

     TabHost.TabSpec spec = th.newTabSpec("tag1")
     .setIndicator("Testimonies", getResources()
      .getDrawable(R.drawable.icon_testimonies_tab))
        .setContent(R.id.tab1);
           th.addTab(spec);


     spec = th.newTabSpec("tag2")
     .setIndicator("Live Blog", getResources()
     .getDrawable(R.drawable.icon_liveblog_tab))
      .setContent(R.id.tab2);
        th.addTab(spec);


        spec = th.newTabSpec("tag3")
        .setIndicator("Streaming Settings", getResources()
        .getDrawable(R.drawable.icon_streamingsetting_tab))
        .setContent(R.id.tab3);
          th.addTab(spec);

          th.setCurrentTab(1);

          th.getCurrentView().setVisibility(View.VISIBLE);

1 个答案:

答案 0 :(得分:1)

我们再次“看到”,@ meduteniopeyemi!我努力解决你所谈论的问题。我过去常常做的是:

tabHost.setOnTabChangedListener(new OnTabChangeListener() {

                    public void onTabChanged(String tabId) {
                            //YOUR CODE checking if "tabId" is the tab you want to REFRESH
                    }
            });

它对我来说到目前为止。它只是让你可以毫无问题地进行任何刷新。