问题
I've been searching for the solution of my problem for some time and didn't find solution.
I want to restore my fragment's layout after screen orientation change. I have Collapsing Toolbar Layout with banner image. After screen rotation my toolbar is always expanded, I want to restore it's behavior. How can I achieve this?
回答1:
You should set ID to the CoordinatorLayout. It will automatically save its state. Believe me.
See here.
回答2:
Try using the following AppBarLayout method:
public void setExpanded (boolean expanded)
However, there's an Android issue addressing the behavior you reported
来源:https://stackoverflow.com/questions/32563300/how-to-restore-collapsing-toolbar-layout-state-after-screen-orientation-change