Anyone have example code using switched Views instead of Activities inside a TabHost on Android?
The Android developer guide (http://developer.android.com/resources/tutorials/views/hello-tabwidget.htm开发者_如何学Pythonl) states:
`You can implement your tab content in one of two ways: use the tabs to swap Views within the same Activity, or use the tabs to change between entirely separate activities. Which method you want for your application will depend on your demands, but if each tab provides a distinct user activity, then it probably makes sense to use a separate Activity for each tab, so that you can better manage the application in discrete groups, rather than one massive application and layout.
In this tutorial, you'll create a tabbed UI that uses a separate Activity for each tab.`
In my cases, it doesn't make sense to have separate activities for the tabs so I want to switch views, but it would be nice to see an example.
Gee, thanks Google!
In my cases, it doesn't make sense to have separate activities for the tabs
I have yet to find a good argument for having separate activities for the tabs.
so I want to switch views, but it would be nice to see an example.
Here is one. Here is another.
The recipe is pretty simple:
Step #1: Add the tab contents as child Views
of the FrameLayout
Step #2: Use the setContent()
(on TabHost.TabSpec
) that takes an ID as a parameter
Step #3: There is no step #3
精彩评论