我的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="@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" />
答案 0 :(得分:1)
在您的colors.xml
文件夹中创建app/src/main/res/values
文件,并在该文件中写入
<color name="yourColor">#FFF8DC </color>
然后将您的launch_background.xml
文件中的
<item android:drawable="@color/yourColor" />
答案 1 :(得分:0)
创建文件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>