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?
CollapsingToolbarLayout is a wrapper for Toolbar which implements a collapsing app bar. It is designed to be used as a direct child of a AppBarLayout .
By calling setTitleEnabled(false); , the title appeared in the toolbar. Show activity on this post. It is the same as setting title in a normal toolbar. In your xml layout file for collapsing toolbar, inside the CollapsingToolbarLayout you'll have a normal toolbar ( android.
You should set ID to the CoordinatorLayout. It will automatically save its state. Believe me.
See here.
set id for both Coordinatorlayout and AppbarLayout.
setting id for Coordinatorlayout was not enough , after adding id to AppbarLayout it worked fine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With