Save the position of scrollview when the orientation changes

后端 未结 6 1660
星月不相逢
星月不相逢 2020-12-02 23:57

These is my layout:

\"detail

I need to save the scrolling position when the orientation change

6条回答
  •  鱼传尺愫
    2020-12-03 00:19

    You If your activity is not changing anything on rotation you can use android:configChanges="orientation|keyboardHidden|screenSize" in manifest file within this particular activity. But this is clearly workaround and not a proper solution.

    Note:

    If you need to use different views for landscape and portraits or if you need to use different views for different devices, One should use bundle and save data onsaveinstancestate and retrieve the data in oncreate. This method stops to recreate the activity and activity assumes that things will be handled by the user himself/herself.

提交回复
热议问题