1:开机自启动
1.1 创建AndroidManifest.xml
项目->构建->Build Android APK->Use Gradle->Create Templates->打钩Copy the Gra...->完成
1.2 添加内容
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.HOME" /> <!-- 添加 -->
<category android:name="android.intent.category.DEFAULT"/> <!-- 添加 -->
</intent-filter>
1.3 编译运行即可开机运行。
2:开机黑屏处理
<一>一张logo页面运行
2.1 在工程目录下添加启动图片 Android/res/drawable-hdpi/splash.png
2.2 在工程目录下添加一个android/res/values/Styles.xml文件
<resources>
<style name="Theme.AppStartLoad" parent="android:Theme">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.AppStartLoadTranslucent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>
2.3 然后在AndroidManifest.xml中的activity中加上
android:theme="@style/Theme.AppStartLoad"
2.4 在AndroidManifest.xml中的application中加上
android:theme = "@style/Theme.AppStartLoadTranslucent"
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>
<二>闪烁运行
2.1 新建styles.xml,新建一个MyAppTheme主题,写入内容:
<?xml version='1.0' encoding='utf-8'?>
<resources>
<style name="MyAppTheme">
<item name="android:windowDisablePreview">true</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowAnimationStyle">@null</item>
<!--
<item name="android:windowBackground">@drawable/splash</item>
-->
</style>
</resources>
2.2 在AndroidManifest.xml文件,选择「XML Source」显示源码,在application节点上添加「android:theme="@style/MyAppTheme"」,保存。
<application android:hardwareAccelerated="true"
android:name="org.qtproject.qt5.android.bindings.QtApplication"
android:label="quitDemo"
android:theme="@style/MyAppTheme">
备注:网上搜到的可用方法,暂时没研究原理,懂得请留言,指导指导!