I have a root view and this root view contains a fragment with viewpager. This is my ContentFragment. And I update view of this ContentFragment for viewpager behaviour. Now, when I activated ActionMode for a view of ContentFragment, the ActionMode initially hides the Toolbar of root view which is desired result like below:
Unfortunately after landscape mode the Toolbar becomes visible again and does not hide. Check below image:
And after that I always get the following view in ActionMode even if I put the device upright:
instead of this: (desired view)
When I manually hide Toolbar by using this line of code:
toolbar.visibility = View.INVISIBLE
or
toolbar.visibility = View.GONE
inside root view, then the ActionMode overlaps first item of ListView like below:
I have
<item name="windowActionModeOverlay">true</item>
used in themes.xml and I'm sure. But the question is why does ActionMode initially hide the Toolbar, but after landscape mode the Toolbar becomes visible again and never hides.
Fixing actionBarSize
to the toolbar height resolved my issue. I just added
<item name="actionBarSize">@dimen/toolbar_action_mode_height</item>
to my themes. And issue resolved.