Change Toolbar color when ViewPager changes page
<p>I've been thinking about this for a while but I can't seem to figure it out. I have a simple app quit 3 tabs (<code>TabLayout</code> + <code>ViewPager</code>) and I want to change the color of the <code>ToolBar</code> when I swipe the tabs. The effect I wanna achieve is to dynamically change the color as the user swipes to the next or previous tab.</p>

<p><a href="https://www.dropbox.com/s/1khy6crd8xifjoq/Demo.mov?dl=0" rel="nofollow">Check video here</a></p>

<p>In the past I've been able to change the background of the <code>ViewPager</code>'s children views by assigning a color to each child view and the using <code>PageTransformer</code> to modify the alpha component which works fine, however, the <code>ToolBar</code> is not a child of the <code>ViewPager</code> therefore I can't set a color for each page since there's only one <code>ToolBar</code> at all times. </p>

<p>Any idea on how can I achieve this?</p>