Changing Toolbar and CollapsingToolbarLayout scroll flags programmatically
问题 I have a single Activity android app with lots of fragments. When I'm showing a list screen I want to use the Toolbar with the, app:layout_scrollFlags="scroll|enterAlways" property. And in the detail fragments I want to use the CollapsingToolbarLayout with an image in it. Since it's a single Activity app, I have only one Toolbar . Is it possible to modify my layout programmatically to suit both cases? 回答1: Yes. Let's say you are going from the CollapsingToolbarLayout fragment to the Toolbar