Refresh or force redraw the fragment

后端 未结 8 1654
失恋的感觉
失恋的感觉 2020-11-30 02:10

I have a fragment that inflates an xml layout. My requirement is to update the text size on all my views inside my fragment when my Activity is resumed. I tried



        
8条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 02:49

    detach().detach() not working after support library update 25.1.0 (may be earlier). This solution works fine after update:

    getSupportFragmentManager()
        .beginTransaction()
        .detach(oldFragment)
        .commitNowAllowingStateLoss();
    
    getSupportFragmentManager()
        .beginTransaction()
        .attach(oldFragment)
        .commitAllowingStateLoss();
    

提交回复
热议问题