0

My app's theme is set to Holo.Light but I have a dark actionbar so the cast button displays as grey and still uses the old button style (changes to blue when connected) and it is not easy to see nor does it fit with my apps look.

I have downloaded the new icon set found here https://developers.google.com/cast/docs/downloads but I dont know how to use the animation drawable provided

In my MenuItem where do I put the animation drawable?

<item android:title="Cast images" app:showAsAction="always"
    android:orderInCategory="1" 
    app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider"
    android:id="@+id/media_route_menu_item"/>

I looked at this question How do I change the style of the MediaRouteButton in the ActionBar? but it didnt really answer because I already have those images in the proper drawable folders\

Edit

this is what my animation drawable looks like

name ic_media_route_connecting_mono_light.xml

<animation-list
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:oneshot="false">
    <item android:drawable="@drawable/ic_media_route_on_0_mono_light" android:duration="500" />
    <item android:drawable="@drawable/ic_media_route_on_1_mono_light" android:duration="500" />
    <item android:drawable="@drawable/ic_media_route_on_2_mono_light" android:duration="500" />
    <item android:drawable="@drawable/ic_media_route_on_1_mono_light" android:duration="500" />
</animation-list>
Community
  • 1
  • 1
tyczj
  • 71,600
  • 54
  • 194
  • 296

1 Answers1

0

Why are you not using Holo.Light.DarkActionBar? Since you are using Holo.Light, system assumes your action bar is light. if, for some reason, you cannot use the correct theme, you have two options:

  • MediaRouter v7 library uses drawable xml files to specify what the images should be used both in normal states and in animation states (for dark and light themes). For normal states, it is called mr_ic_media_route_holo_dark.xml or mr_ic_media_route_holo_light.xml (you can find them in the AOSP, for example here). You can copy the light one into your project and update the images that it points to.
  • You can trick the system by renaming your dark images to light or vice versa so system uses your reverted images.

If possible, I suggest you just update your theme to use Holo.Light.DarkActionBar.

Ali Naddaf
  • 16,951
  • 2
  • 21
  • 28
  • The Holo.Light.DarkActionBar uses a dark overflow menu which does not look right in a light themed app. My actionbar is transparent with a gradient like in the play store which is why I am trying to use the white cast icons. Are the images from the downloads link I posted not the same because I already have those images and the drawable animation in my app – tyczj Jul 03 '14 at 17:51
  • They should be correct ones but have you changed dark <-> light in your project when you copied the drawables? – Ali Naddaf Jul 03 '14 at 18:20
  • yes I changed all the names from dark to light, see my edit in my question. The only thing I didnt do is put `mr` in the name does that matter? Is there somewhere I am suppose to set these drawables? – tyczj Jul 03 '14 at 22:25
  • I got the icon to turn white in the actionbar by adding `mr` to the name but it still turns blue when connected. and it also does not animate either – tyczj Jul 03 '14 at 22:36
  • I got it, the `mono` and `holo` make a difference, changed to the holo images and it all works now – tyczj Jul 03 '14 at 23:15