我的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>
Run Code Online (Sandbox Code Playgroud)
我只想知道,如何将其更改<item android:drawable="@android:color/white" />为自定义颜色,例如<item android:drawable="@android:color/#FFF8DC" />
Luk*_*tti 29
创建文件 android/app/src/main/res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#FF0000</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
编辑 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>
Run Code Online (Sandbox Code Playgroud)
colors.xml在您的app/src/main/res/values文件夹中创建文件并在该文件中写入
<color name="yourColor">#FFF8DC </color>
Run Code Online (Sandbox Code Playgroud)
然后在你的launch_background.xml文件中使用它,
<item android:drawable="@color/yourColor" />
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8226 次 |
| 最近记录: |