开发者

add dynamic view to android tabhost

How can I add a dynamic view in a TabHost.

I have two tabs i.e. TabA and TabB. In TabA, I have 2 buttons and I want to set the layout (I have开发者_开发技巧 2 different XML layout's) of TabB, depending upon the button pressed in TabA.

Can anyone help me. Thank you!


That depends on the implementation of your TabHost. Have you used Activities or Views as Tabs?

Generally in your TabActivity you could use getTabHost().getTabWidget().getChildAt(index) or another method to get the view of a Tab.

If you use Activities as the children, you could also start a new Intent with your ActivityGroup and set a new view within the onCreate() method.

If you have problems finding examples for ActivityGroups with TabHosts, I can provide you a code sample showing you how to do it and also how to change the view within another tab by clicking a button.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜