Android Fragment backstack和Tabs

时间:2016-11-23 13:48:56

标签: android android-fragments

我有3个片段 - a,b和c。 片段a显示一些项目,片段b显示与片段a相同,片段c包含3个选项卡。当我打开片段A - > b - > c并返回到片段b并再次打开片段c,然后在每个选项卡上使用onCreateView,而不是被调用,所有选项卡都是空白的。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

在片段c的onResume中有一些你不做的事情,这是标签内容所必需的。因此,事实上在这种情况下没有做任何事情,因为c只是暂停了!所以我的建议是这样做的:

    @Override
    public void onResume(){
    super.onResume();
    //Paste the same code you have and used in onCreateView() and run again.
    //If nothing happens override onStart and do the same thing!
    //else post some codes so that we can easily figure where the problem is..
    }