简体   繁体   English

Android Fragment堆栈和选项卡

[英]Android Fragment backstack and Tabs

I have 3 fragments - a , b and c. 我有3个片段-a,b和c。 Fragment a shows some items, fragment b same as fragment a , fragment c contains 3 tabs. 片段a显示了一些项目,片段b与片段a相同,片段c包含3个标签。 As I open fragment A --> b --> c and go back to fragment b and again open fragment c, then onCreateView for each tab, not getting called and all tabs are blank. 当我打开片段A-> b-> c并返回片段b,然后再次打开片段c,然后为每个选项卡打开onCreateView时,不会被调用,所有选项卡都为空白。 Can anyone please help me? 谁能帮帮我吗?

There is something you dont do in the onResume of fragment c which is necessary for contents of the tabs. 在片段c的onResume中,您不需要执行某些操作,这些操作对于选项卡的内容是必需的。 So as a matter of facts nothing is done in that situation because c was paused only! 因此,事实上,在这种情况下什么也不做,因为c仅被暂停了! So my advice do this: 所以我的建议是这样做的:

    @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..
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM