我正在制作一个使用选项卡栏的应用程序。
现在我需要知道的是,如何通过打开其他选项卡setOnTabChangedListener()
在我的代码中
例如。我当前位于选项卡中,当我单击第二个选项卡时,它应该调用第二个选项卡的活动。
看下面的代码
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the Movies tab.
intent = new Intent().setClass(this, BarActivity.class);
// Initialise a TabSpec for the Movies tab and add it to the TabHost.
spec = tabHost.newTabSpec("Nights").setIndicator("Nights").setContent(intent);
tabHost.addTab(spec);
// Do the same things for the Theatres tab.
intent = new Intent().setClass(this, BarActivity.class);
spec = tabHost.newTabSpec("Weeks").setIndicator("Weeks").setContent(intent);
tabHost.addTab(spec);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)