您的位置:首页 > 移动开发 > Android开发

Qt for Android 程序启动闪一下黑屏的优化方法

2016-09-08 17:25 666 查看
在工程目录下添加启动图片 android/res/drawable-hdpi/splash.png

在工程目录下添加一个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>


然后在AndroidManifest.xml中的activity中加上

android:theme="@style/Theme.AppStartLoad"


在在AndroidManifest.xml中的application中加上

android:theme = "@style/Theme.AppStartLoadTranslucent"


然后添加下面的内容,不然当主界面内容比较多时,依旧会出现黑屏问题。

<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>


这样程序启动就会显示splash.png图片,不会出现黑屏了。

但是启动界面到主界面还是有一闪的问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android qt