I'd like to use a CollapsingToolbarLayout
to achieve an effect as in the following image:
To accomplish this, I first tried to set the status bar background color to a 30% opacity black in my theme. This works fine for the expanded state and achieves the intended effect.
However, I'd also like to use @color/primaryColorDark
for the status bar as background when the CollapsingToolbarLayout
is collapsed. So I set app:statusBarScrim
to @color/primaryColorDark
, but because the status bar background is set to semi-transparent black in the theme, the color is darker than @color/primaryColorDark
.
How do I set a status bar scrim that is used when the CollapsingToolbarLayout is expanded? CollapsingToolbarLayout
has app:statusBarScrim
for the collapsed state, but there is no such attribute for the expanded state. If I could do this, I can set the status bar to fully transparent and avoid the problem of the overly dark status bar in collapsed state.
Alternatively, is there a way to only set the status bar background to transparent when the CollapsingToolbarLayout
is collapsed?