I have created a tab view. What i want is that when i switch between 2 views of my tab a progress bar is generated. How can i do so.....
Here is my code:
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 s开发者_Python百科pec; // 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);
}
}
精彩评论