Qt for Android 启动短暂的黑屏或白屏问题如何解决?

摘要:
--添加上面的一个,只需将黑屏设置为透明,启动就会很慢--˃˂!
解决方法一:

使用透明主题
点击项目 -> 在 构建设置 里面找到 Build Android APK 栏目,点击 create templates 创建一个 AndroidManifest.xml

<?xml version="1.0"?>
<manifest package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="-- %%INSERT_APP_NAME%% --">
        <activity
            android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation"
            android:name="org.qtproject.qt5.android.bindings.QtActivity"
            android:label="-- %%INSERT_APP_NAME%% --"
            android:screenOrientation="unspecified"
            android:launchMode="singleTop"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
						<!--  添加上面一条即可,只是把黑屏设置成透明的而已,启动还是会慢  -->
						<!--  @android:style/Theme.Translucent   -->
            <!-- @android:style/Theme.Translucent.NoTitleBar   -->
            <!-- @android:style/Theme.Translucent.NoTitleBar.Fullscreen   -->
            >

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>

            <!-- Application arguments -->
            <!-- meta-data android:name="android.app.arguments" android:value="arg1 arg2 arg3"/ -->
            <!-- Application arguments -->

            <meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
            <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
            <meta-data android:name="android.app.repository" android:value="default"/>
            <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
            <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
            <!-- Deploy Qt libs as part of package -->
            <meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
            <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
            <!-- Run with local libs -->
            <meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
            <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
            <meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
            <meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
            <meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
            <!--  Messages maps -->
            <meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
            <meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
            <meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
            <!--  Messages maps -->

            <!-- Splash screen -->
            <!-- meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/ -->
            <!-- meta-data android:name="android.app.splash_screen_sticky" android:value="true"/ -->
            <!-- Splash screen -->

            <!-- Background running -->
            <!-- Warning: changing this value to true may cause unexpected crashes if the
                          application still try to draw after
                          "applicationStateChanged(Qt::ApplicationSuspended)"
                          signal is sent! -->
            <meta-data android:name="android.app.background_running" android:value="false"/>
            <!-- Background running -->

            <!-- auto screen scale factor -->
            <meta-data android:name="android.app.auto_screen_scale_factor" android:value="false"/>
            <!-- auto screen scale factor -->

            <!-- extract android style -->
            <!-- available android:values :
                * full - useful QWidget & Quick Controls 1 apps
                * minimal - useful for Quick Controls 2 apps, it is much faster than "full"
                * none - useful for apps that don't use any of the above Qt modules
                -->
            <meta-data android:name="android.app.extract_android_style" android:value="full"/>
            <!-- extract android style -->
    </activity>

    <!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->

    </application>

    <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="16"/>
    <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>

    <!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
         Remove the comment if you do not require these default permissions. -->
    <!-- %%INSERT_PERMISSIONS -->

    <!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
         Remove the comment if you do not require these default features. -->
    <!-- %%INSERT_FEATURES -->

</manifest>

解决方法二:

使用图片替换主题

在res/values文件目录下新建一个 style.xml 文件,文件内容如下
<?xml version='1.0' encoding='utf-8'?>
<resources>
<style name="Theme.AppStartLoad" parent="android:Theme">
    <item name="android:windowBackground">@drawable/logo</item>
		<!-- @drawable/logo 确保 android
esdrawable-hdpilogo.png 存在 -->
    <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 中应用上面定义的两个主题,添加的位置如下
<application   android:theme = "@style/Theme.AppStartLoadTranslucent">
<activity  android:theme="@style/Theme.AppStartLoad">

            <!-- Splash screen -->
            <!-- <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/> -->
            <!-- <meta-data android:name="android.app.splash_screen_sticky" android:value="true"/> -->
            <!-- Splash screen -->
						//这上面的是添加启动图片
解决方案三
https://falsinsoft.blogspot.com/2017/07/qml-show-android-native-splash-screen.html

免责声明:文章转载自《Qt for Android 启动短暂的黑屏或白屏问题如何解决?》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇python-lambda表达式freemarker常用的基本命令下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Android开发 View的阴影详解

前言  Android的阴影概念是跟随Material Design设计风格出现的,因为Material Design的设计有Z轴概念,就是每个View都有自己的深度层级。Z轴的概念有了之后必然有表现这一概念的阴影效果的实现。所以google在Android5.0版本添加这阴影效果的支持。此篇博客不啰嗦Material Design的部分,我们只聊聊阴影的...

使用 Fresco加载图片

概念: ImagePipeline ——负责从网络、本地图片、Content Provider(内容提供者)或者本地资源那里获取图片,压缩保存在本地存储中和在内存中保存为压缩的图片 Drawee——处理图片的渲染,由3部分组成: (1)DraweeView——显示图片的View,继承ImageView;大部分时间将使用SimpleDraweeView (2...

launcher- 第三方应用图标替换

有时候我们感觉第三方应用的icon不美观,或者跟我们主题风格不一致,这时候我们希望换成我们想要的icon,那我们可以这么做(以更换QQ应用icon为例): 1.首先我们当然要根据自己的需要做一张替换icon了(图片我们不妨命名为qq) 2.接下来我们需要得到第三方应用的信息,可以通过GetDftlayoutXml.apk 工具获得 具体步骤如下 1)网上...

android简易计算器的实现

最近接触了android开发就试着写了一个计算器的小程序: 在xml文件中的布局代码如下: 1 <?xml version="1.0" encoding="utf-8"?> 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 3...

Android中activity背景色的设置

主题Theme就是用来设置界面UI风格,可以设置整个应用或者某个活动Activity的界面风格。在Android SDK中内置了下面的Theme,可以按标题栏Title Bar和状态栏Status Bar是否可见来分类: [html] view plaincopyprint? •android:theme="@android:style/Th...

【移动安全高级篇】————4、Android手机一键Root原理分析

一直以来,刷机与Root是Android手机爱好者最热衷的事情。即使国行手机的用户也不惜冒着失去保修的风险对Root手机乐此不疲。就在前天晚上,一年一度的Google I/O大会拉开了帷幕,最新的Android4.1系统成为了大会的热点,经过短短的几个小时后,网上就有人泄露了Jelly Bean的下载地址,再然后就有了Android 4.1带Root的完整...