Reputation: 552
Well,
I have a TabActivity (TabHost) with 3 tabs. In one of my tabs, there is a button. What I want is whenever this button is clicked, change contentview of this tab. I have read that I can't use "setContentView" two times. So, I found ViewSwitcher, ViewFlipper, ViewAnimator but the probleem about them is I can't add xml files (or LinearLayout) to these clasees. All examples is about the switching of one textview and imageview which is useless.
So, how can I change the layout of the current tab? Is there any way to do that? I tried to call this layout within another class with using Intent, but this time this intent doesn't fit in tab, rather make a full screen view.
Thanks in advance.
Upvotes: 0
Views: 231
Reputation: 31789
All you need to do is use the tag. With this you can include another xml in the xml file your activity use. This helps in sharing xml code.
This is how you use it.
<include layout="@layout/view_part"/>
where view_part is the name of another xml file.
Keep the includes inside the viewflipper and now you can switch the views.
Upvotes: 1