android - activity with viewpager and fragments does not resume the potrait layout when rotating the device. Only on Huawei smartphones

  • Replies:0
  • OpenNot stickiedUnanswered
  • Forum posts: 1

Jun 1, 2016 5:53:28 PM via Website


I'am facing a strange problem that is happening only on the new device I am trying: Huawei P8.

I can't put a screenshot of what is happening but I will try to summarize as follow:

  • The activity has only one layout in folder "layout"
  • Some of the fragments that compose the viewpager have both "layout" and "layout-land" layouts for different views depending on the rotation of the device.


  • Starting the activity in potrait everything works and the fragments have their potrait layout

  • Rotating to landscape makes the fragments switch to their landscape layout (if the fragment has its custom landscape layout draws it) correctly

  • When rotating back to potrait the problem appears. The fragments that have a specific landscape layout does not switch back to potrait layout keeping the landscape one and the result is:

    With the device in potrait the layout is drawn with landscape layout (took from layout-land) which is very bad to see because every view is compressed/stretched unnaturally.

I have tried many smartphones in the years and this only happens on Huawei P8 (android 5.0)