chrom cast error with background can not be translucent: #0

 
Recently, I integrated chromcast into the project, and I kept reporting errors. Later, I found that my theme was wrong. I had to use
the theme under Theme.AppCompat. Before my activity, I used @android:style/Theme.NoTitleBar
. I also looked at the source code. This is probably because inflate uses different themes to draw the view when loading the xml, and then different themes have different writing methods. The

correct theme
<style name="AppThemeCast"
           parent="Theme.AppCompat.NoActionBar ">
        <!-- Set AppCompat's color theming attrs -->
        <item name="colorPrimary">@color/white</item>
        <item name="colorPrimaryDark">@color/black</item>
        <item name= "colorAccent">@color/gray</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android: textColorSecondary">@color/black</item>
        <item name="windowNoTitle">true</item>
        <!-- The rest of your attributes -->
        <!--item name="android:seekBarStyle">@style/YellowSeekBar</item-->
    </style>



Caused by: java.lang.IllegalArgumentException: background can not be translucent: #0
            at android.support.v4.graphics.ColorUtils.calculateContrast(ColorUtils.java:92)
            at android.support.v7.app.MediaRouterThemeHelper.getControllerColor(MediaRouterThemeHelper.java:75)
            at android.support.v7.app.MediaRouterThemeHelper.createThemedContext(MediaRouterThemeHelper.java:53)
            at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:123)
            at android.support.v7.app.MediaRouteButton.<init>(MediaRouteButton.java:119)

https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=&id=192960

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326992330&siteId=291194637