我正在使用Angular SPA,并且启用了服务程序。我已经在索引页面上添加了manifest.json文件。
现在我要使用两个不同的图标
请参阅下面的代码:
manifest.json
{
"name": "myApp",
"short_name": "myApp",
"theme_color": "#1c4cc3",
"background_color": "#ffffff",
"display": "standalone",
"scope": "/",
"start_url": "/",
"icons": [
{
"src": "assets/icons/logo-192x192.png",
"sizes": "192x192",
"type": "image/png"
}
]
}
将此内容包含在index.html页面中
<link rel="manifest" href="manifest.json">
答案 0 :(得分:-2)
首先,创建一个可绘制的资源文件:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">
<item android:drawable="@color/colorPrimary"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/icon"/>
</item>
</layer-list>
然后将其以样式应用于您的活动主题(主题必须分配给Main活动):
<item name="android:windowBackground">@drawable/splash</item>
最后,将其应用于清单上的活动:
android:theme="@style/yourTheme"
你去...