开发者

Switch over between Tabs in android?

I have a tab host contain four tabs,in my first tab i have two button , when i click first button i need to go to the second tab in tab host, similarly when i cl开发者_如何学运维ick the third button i need to go to third tab .

If anyone know the solution please help me out.


The TabHost has a method called 'setCurrentTab(int index)' which you can call inside your button's onclick handler. http://developer.android.com/reference/android/widget/TabHost.html#setCurrentTab(int)


Karthi,

This can be done with the setCurrentTab() method from TabHost. You may want to follow this tutorial: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html


Use:

tabHost.setCurrentTab(index);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜