【问题标题】:Flutter: "Cannot resolve symbol '@android:color/white'" while changing splash screen颤振:“更改启动画面时无法解析符号'@android:color/white'”
【发布时间】:2020-03-10 18:51:04
【问题描述】:

我正在按照 this 教程向应用添加启动画面。

我将图像添加到drawable 文件夹并相应地修改了第 10 行。

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />

<!-- You can insert your own image assets here -->
<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/my_image.png" />
</item>

预览继续加载,@android 和 @drawable 都以红色显示。 当我悬停时,我收到相同的消息:“无法解析符号@...”。 如何解决错误?

【问题讨论】:

  • 这应该被标记为 Android 问题,而不是 Flutter。

标签: android xml splash-screen


【解决方案1】:

正如项目所说的可绘制它不应该是一种颜色。尝试将其标记为:

<item android:background="@android:color/white" />

@android:color/white 只能用于颜色、背景或文本颜色。对于drawable,您应该在drawable或mipmap资源中分配drawable XML或图像

【讨论】:

    猜你喜欢
    • 2018-09-15
    • 1970-01-01
    • 2017-12-12
    • 2021-08-23
    • 2020-09-03
    • 2021-02-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多