如何在Android电子标签之间切换? [英] How to switch between tabs in Android?

查看:143
本文介绍了如何在Android电子标签之间切换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何从所在的选项卡主机中的活动之一中的多个标签之间切换?我需要明天来完成该项目。我的项目涉及展示3个标签具有不同的内容。所以,请帮助任何人。

How do I switch between tabs from within one of the activities that is located inside the tab host? I need to complete the project by tomorrow. My project involves showing 3 tabs with varying content. So please help anyone.

推荐答案

如果您添加标签为活动,你可以使用这个code选项卡子活动在

If you added the tabs as activities you can use this code inside a tab child activity

TabActivity main = (TabActivity) getParent(); // get the main 'TabActivity' from a Child (tab)
TabHost tabHost = main.getTabHost(); // get a handle to the TabHost
tabHost.setCurrentTab(<index>)

这篇关于如何在Android电子标签之间切换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆