Search code examples
javaandroidchromecast

How to add custom style for cast button in cast sdk v3?


I integrated cast to my app, and the default cast button color is black, but i'd prefer it white.

So I have 2 questions :

  1. From what style does it taken from default ?
  2. How can i change the style or color of the icon ?

Im using cast sdk v3.

I read the other related posts but they're all relevant to sdk v2.

this is my menu item layout as in google sample :

<item
        android:id="@+id/media_route_menu_item"
        android:title="@string/media_route_menu_title"
        app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
        app:showAsAction="always"/>

this is the menu code to create the button :

   @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);

        getMenuInflater().inflate(R.menu.menu_podcast, menu);

        mMediaRouteItem =
                CastButtonFactory.setUpMediaRouteButton(getApplicationContext(),
                        menu,
                        R.id.media_route_menu_item);

        return true;
    }

Solution

  • Solution was simple as changing the activity theme to extend Theme.AppCompat instead of Theme.AppCompat.Light.DarkActionBar