Fragment without a view crashes on configuration change

后端 未结 2 2082
生来不讨喜
生来不讨喜 2020-12-15 05:57

I have an UI where I need a Fragment to be displayed (with a view) in landscape mode but not in portrait mode. In portrait mode it should still be available but

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-15 06:27

    Your problem can also be due to not having a lanscape layout for the fragment you are using. You might have one for the portrait and so your program runs fine but when you rotate your device, the OS probably looks for the view in the landscape folder and doesnt find the view so declares it as missing. Check that you have view both in the folder "layout" and "layout-land".

提交回复
热议问题