Reading Time: 2 minutes

Changing the Chromecast icon color by styling MediaRouteButton

Ever since Chromecast has been added as a standard functionality to mobile applications, designers want to apply a brand color to the standard cast icon.

The only way (without the support library) is to copy assets from mediarouter library, edit as needed and override the default assets or style.

While a simple fix, it’s time consuming and over engineering for a simple color change.

Android developers stopped hacking with overrides when the v7 mediarouter library added setRemoteIndicatorDrawable to the MediaRouteButton.

The second step on the right path is the setTint method, the problem is the MediaRouteButton’s drawable is not accessible in the standard way.

But it can be done, if one knows the inner workings of the support library:

Copy to Clipboard

Put the two together and a simple, no hacks, no custom components solution emerges:

Copy to Clipboard

Check out the full demo, with a color picker and Toolbar menu cast icon on:

https://github.com/andrei-egeniq/android-tibits/tree/master/CastColor

Newsletter

Become an app expert? Leave your e-mail.

nederlandse loterij en egeniq
pathe thuis en egeniq
rpo and egeniq
mvw en egeniq
rtl and egeniq