After the user scrolls down the screen, the image in the CollapsingToolbarLayout disappears and is left with a toolbar with the back button, content title, and settings menu. I want to know how to change the background color of that toolbar only when its in a 'collapsed' state.
The action I am referring to is similar to this where the toolbar background color changes to green:
Below the CollapsingToolbarLayout I have a NestedScrollView with CardViews
getColor(R. color. my_color_id)); It worked for me and changed the color of the collapsingToolbar once it was collapsed to help me fit the main color of an image that was displayed when the collapsingToolbar was full scale.
Just go to res/values/styles. edit the xml file to change the color of action bar.
Android 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. This type of layout is commonly seen in the Profile Screen of the Whatsapp Application.
I think you're after app:contentScrim
.
<android.support.design.widget.CollapsingToolbarLayout ... app:contentScrim="?attr/colorPrimary"> <!-- Toolbar and ImageView here --> </android.support.design.widget.CollapsingToolbarLayout>
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