How to keep fragment view state?

前端 未结 1 1657
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-26 03:40

I have doubt in fragment system.

I have two fragments like A and B

If i move A to B,

Navigati         


        
1条回答
  •  花落未央
    2021-01-26 04:21

    You have to store recyclerview scroll position, FAB button visibility in a variable and set those values after onViewCreated is called.

    OR

    You can store it in Bundle of onSaveInstanceState and retain its state

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
    }
    

    0 讨论(0)
提交回复
热议问题