1. 在路径为 platforms/android/res/values/ 下新建styles.xml,编辑如下:
<resources>
    <style name="Theme.AppStartLoadTranslucent" parent="android:Theme">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>

这个是透明主题,所以有个副作用:当用户切换多个应用的间隙时会存在透明引起的不良体验,但是很少人会注意到。
2. 在 platforms/android/AndroidManifest.xml 中的android:name为”MainActivity”的activity,修改它的theme值,如:android:theme="@style/Theme.AppStartLoadTranslucent"
3. 然后cordova build android就可以啦

  1. 如果需要添加启动图片可以用下面配置
<resources>
    <style name="Theme.AppStartLoadTranslucent" parent="android:Theme">
        <item name="android:windowBackground">@drawable/screen</item>
        <item name="android:windowNoTitle">true</item>
    </style>
</resources>
Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐