Individual screen is showing instead of a tabhost in android eclipse

我与影子孤独终老i 提交于 2019-11-30 16:42:44

okay. let me explain it briefly first.

When you call startActivity() it simply means you are trying to call Activity class. But it doesn't mean that you will be able to have your tab bar in all the screens you navigate to. Because tabs are related to the tabActivity and which means its totally separate from the normal activity. So to have your Tabs visible in all the pages, you have to replace the views thus staying in the same tabActivity.

So the first step is to get the next activity which you want to display as a view and add it to the tabs. This is what Activity Group is emant to do. Here is a very good example of how to understand ActivityGroup.

ActivityGroup Example

To make this more easier, Fragments are introduced. it does the same operation as Activity Group(to replace views). here are few examples,

http://android.codeandmagic.org/2011/07/android-tabs-with-fragments/

http://developer.android.com/resources/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentTabs.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!