android - 无意刷新 Android 标签页

标签 android tabs android-tabhost

请问如何在不添加 Intent 的情况下刷新选项卡 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);

最佳答案

我们又“见面”了,@meduniopeyemi!我努力工作试图解决你正在谈论的问题。我以前的做法是:

tabHost.setOnTabChangedListener(new OnTabChangeListener() {

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

到目前为止它对我有用。它只允许您毫无问题地进行任何刷新。

关于android - 无意刷新 Android 标签页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12974542/

相关文章:

android - ScrollView 内的 TabHost 将焦点设置为内容并滚动

android - 将 OpenGL 应用程序移植到 NDK。着色器效果看起来不同

java.lang.UnsupportedOperationException : Can't convert to color: type=0x2 异常

android - 滚动回收器 View 时如何防止项目重复

Android 应用程序中的 java.lang.NullPointerException

php - PHP 中的 Tab 键操作?

java - 使用 TabHost 和 LocalActivityManager 时不调用 Android OnResume

javascript - 是否可以使用 ie 选项卡 View 在 chrome 上调试 javascript?

删除 mysql 数据的 Javascript 警报在新选项卡中打开

android - 每次更改选项卡时都会调用 tabhost 上的 onCreateView fragment