1
votes

I'm trying to create my splash screen with native android, i'm using flutter, and my android project is in kotlin, i'm trying to create new color to android, because i need specific hexa color, but i can't create my own color, when i try, the flutter say can't recognize the name of color.

Thats is some of attempts:

<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>

    </style>
        <color name="goiaba">#e1635a</color>

</resources>

The file is android -> app -> res -> values -> styles.xml

<!-- 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/black" />

    <item android:drawable="@android:color/holo_blue_light">

    </item>
</layer-list>

The file is android -> app -> res -> drawable -> launch_background.xml

When the item drawable is color holo_blue_light its works fine because its android color already, but when i try put the color "goiaba" doesn't works...

Thats is the message of error: android/app/src/main/res/drawable/launch_background.xml:13: AAPT: error: resource android:color/goiaba not found.

2

2 Answers

3
votes

I'm found how create new color in android with flutter project, i need create the colors.xml in PROJECT/android/app/src/main/res/values/ and i added using @color/COLOR_NAME

1
votes

It's ok that not create the colors.xml file, the reason why you did not succeed for the first try is that you used @android:color/goiaba instead of @color/goiaba .