颤振更改初始屏幕背景色
问题描述:
我的launch_background.xml
文件中包含以下默认代码:
I have this default code in my launch_background.xml
file:
<?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="@mipmap/ic_launcher" />
</item>
</layer-list>
我想知道如何将<item android:drawable="@android:color/white" />
更改为自定义颜色,例如<item android:drawable="@android:color/#FFF8DC" />
I would just like to know, how do I change this <item android:drawable="@android:color/white" />
to a custom colour, something like <item android:drawable="@android:color/#FFF8DC" />
答
创建文件android/app/src/main/res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#FF0000</color>
</resources>
编辑android/app/src/main/res/drawable/launch_background.xml
<?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="@color/red" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>