根据 Android 的标签栏片段中的条件显示不同的 class/xml

Display different class/xml depending on condition in Tab Bar Fragments for Android

我遇到了一些奇怪的情况。我有两个不同的 xml 视图,我将根据特定条件向用户显示它们。我正在使用带有片段的选项卡栏作为选项卡。比方说,是否可以显示视图一,然后单击该视图上的按钮,然后整个视图将更改为视图二,同时仍在同一标签栏上,标签栏仍在底部。也许会出现某种动画或显示过渡的东西,但目前还不重要。

谢谢!

我认为您正在寻找片段http://developer.android.com/guide/components/fragments.html this should help you. What you have to do is display a fragment (wich is a portion of the activity) that you can inflate from xml and then replace that fragment like in that post Replacing a fragment with another fragment inside activity group