Android Material Design - How to change background color of Toolbar after CollapsingToolbarLayout is collapsed

前端 未结 6 1843
情歌与酒
情歌与酒 2020-12-07 22:54

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,

6条回答
  •  佛祖请我去吃肉
    2020-12-07 23:39

    Maybe what you have been looking for is this :

    myCollapsingToolbar.setContentScrimColor(getResources().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. With this, the color can obviously be changed programatically!

    I know I'm late, but I hope it could help.

提交回复
热议问题