选项卡视图中的进度条

时间:2011-03-03 08:15:53

标签: android

我创建了一个标签视图。我想要的是,当我在我的标签的2个视图之间切换时,会生成一个进度条。我怎么能这样做.....

这是我的代码:

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tab);

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  // Resusable TabSpec for each tab
        Intent intent;  // Reusable Intent for each tab
        TabWidget tabs = new TabWidget(this);
        tabs.setId(android.R.id.tabhost);
        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, ImageExercise.class);

        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("images").setIndicator("Images",
                          res.getDrawable(R.drawable.imageicon))
                      .setContent(intent);
        tabHost.addTab(spec);

        // Do the same for the other tabs
        intent = new Intent().setClass(this, AudioPlay.class);
        spec = tabHost.newTabSpec("songs").setIndicator("Songs",
                          res.getDrawable(R.drawable.audioicon))
                      .setContent(intent);
        tabHost.addTab(spec);

        intent = new Intent().setClass(this, VideoActivity.class);
        spec = tabHost.newTabSpec("videos").setIndicator("Videos",
                          res.getDrawable(R.drawable.videoicon))
                      .setContent(intent);
        tabHost.addTab(spec);

        tabHost.setCurrentTab(2);
    }

}

0 个答案:

没有答案