在android中的Tabs之间切换?

时间:2011-05-31 18:52:09

标签: android android-layout

我有一个标签主机包含四个标签,在我的第一个标签中我有两个按钮,当我点击第一个按钮我需要转到标签主机中的第二个标签,同样当我点击第三个按钮我需要去第三个标签。

如果有人知道解决方案,请帮助我。

3 个答案:

答案 0 :(得分:0)

使用:

tabHost.setCurrentTab(index);

答案 1 :(得分:0)

TabHost有一个名为'setCurrentTab(int index)'的方法,您可以在按钮的onclick处理程序中调用它。 http://developer.android.com/reference/android/widget/TabHost.html#setCurrentTab(int

答案 2 :(得分:0)

卡,

可以使用TabHost中的setCurrentTab()方法完成此操作。您可能希望学习本教程:http://developer.android.com/resources/tutorials/views/hello-tabwidget.html