发现在点击应用图标启动APP后,会先出现短暂的黑屏或者白屏再出现启动页,这种用户体验很差,遂,寻找解决办法。发现我们可以通过自定义Theme来实现瞬间响应启动页。
方法一:
自定义Theme如下:
<style name="AppLaunch" parent="android:Theme"> <item name="android:windowBackground">@mipmap/launchimage_1080x1920</item> <item name="android:windowNoTitle">true</item> </style>
AndroidManifest文件中配置如下:
<activity android:name="au.com.joincc.secusoft.live.LaunchActivity" android:theme="@style/AppLaunch" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
方法二:
自定义Theme如下:
<style name="AppLaunch" parent="android:Theme"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowNoTitle">true</item> </style>
AndroidManifest中的配置同方法一
个人两种方法都使用过,发现第一种方法更合适,实现瞬间响应启动页。