开发者

Switch over between Tabs in android?

开发者 https://www.devze.com 2023-03-09 07:32 出处:网络
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

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

精彩评论

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