【问题标题】:A TaskDescription's primary color should be opaqueTaskDescription 的原色应该是不透明的
【发布时间】:2019-04-05 18:51:15
【问题描述】:

错误

java.lang.RuntimeException:无法启动活动 ComponentInfo{com.example.vigneshbaskar.concavechat/com.example.vigneshbaskar.concavechat.MainActivity}:java.lang.RuntimeException:TaskDescription 的原色应该是不透明的

java

package com.example.vigneshbaskar.concavechat;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.vigneshbaskar.concavechat.MainActivity">

</RelativeLayout>

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.vigneshbaskar.concavechat">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="com.example.vigneshbaskar.concavechat.MainActivity"
            android:theme="@style/FullTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

【问题讨论】:

  • 请显示完整的logcat
  • 另外,发布FullTheme的定义,包括它的颜色。

标签: android


【解决方案1】:

你不能在原色中使用 Alpha,只是让你的原色不透明。转到res&gt;values&gt;colors 并用此#3F51B5(蓝色)替换您的颜色主代码;

【讨论】:

    【解决方案2】:

    styles/FullTheme.xml 中,从@color/primaryColor 定义中删除Alpha 通道。颜色的前两位数字是它的 alpha 通道,例如#CCFF0000。删除CC(在本例中)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-06
      相关资源
      最近更新 更多