5.1 崩溃 - TaskDescription 的原色应该是不透明的 [英] 5.1 Crash - A TaskDescription's primary color should be opaque

查看:19
本文介绍了5.1 崩溃 - TaskDescription 的原色应该是不透明的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序中实现了材料设计,它在 < 上运行得非常好.Android 5 但当我尝试在 Android 5.0 及更高版本上运行时,我的 logcat 中出现以下内容.

I have implemented material design into my app and it runs perfectly fine on < Android 5 but when I try to run on Android 5.0 and above I get the following in my logcat.

     FATAL EXCEPTION main
 Process com.test.test, PID 3195
 java.lang.RuntimeException Unable to start activity ComponentInfo{com.test.test/com.test.test.MainActivity} java.lang.RuntimeException A TaskDescription's primary color should be opaque
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java2298)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java2360)
    at android.app.ActivityThread.access$800(ActivityThread.java144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java1278)
    at android.os.Handler.dispatchMessage(Handler.java102)
    at android.os.Looper.loop(Looper.java135)
    at android.app.ActivityThread.main(ActivityThread.java5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java694)
 Caused by java.lang.RuntimeException A TaskDescription's primary color should be opaque
    at android.app.ActivityManager$TaskDescription.<init>(ActivityManager.java536)
    at android.app.Activity.onApplyThemeResource(Activity.java3677)
    at android.view.ContextThemeWrapper.initializeTheme(ContextThemeWrapper.java140)
    at android.view.ContextThemeWrapper.setTheme(ContextThemeWrapper.java85)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java2244)
    ... 10 more

这是我的风格:

    <resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.


    -->


    <!-- All customizations that are NOT specific to a particular API-level can go here. -->

    <style name="AppTheme" parent="@style/Theme.AppCompat.NoActionBar">

        <!-- All customizations that are NOT specific to a particular API-level can go here. -->

        <item name="colorPrimaryDark">#4DFF9800</item>
        <item name="colorPrimary">#4D607D8B</item>
    </style>

</resources>

如果有人能给我一些指导,那将非常感谢.

If anyone could give me some guidance that would be great thanks.

推荐答案

不能在原色中使用 alfa.原色必须是不透明的.

You can not use alfa in primary color. The primary color has to be opaque.

变化:

<item name="colorPrimaryDark">#4DFF9800</item>
<item name="colorPrimary">#4D607D8B</item>

<item name="colorPrimaryDark">#FF9800</item>
<item name="colorPrimary">#607D8B</item>

对于 res/values-v21/style.xml 文件中的 api 21

for api 21 in res/values-v21/style.xml file

这篇关于5.1 崩溃 - TaskDescription 的原色应该是不透明的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆