首页 > 系统 > Android > 正文

Android的App启动时白屏的问题解决办法

2019-12-12 02:17:19
字体:
来源:转载
供稿:网友

Android的App启动时白屏的问题解决办法

在手机上调试后第一次启动后会等待很长时间白屏,

设置style样式,给activity加上设置的样式,完美解决

参考一下下面的代码.就可以解决(亲测好用)

<style name="SplashTheme" parent="AppBaseTheme">  <!-- 将splash图片设置在这,这样这张图片取代白屏 -->  <item name="android:windowBackground">@drawable/splash</item>  <item name="android:windowFullscreen">true</item>  <!-- 或者是将主题设置成透明,虽然点击图标会有点小小的卡顿,但是用户体验不影响 -->  <!-- <item name="android:windowIsTranslucent">true</item> --> <!-- 透明背景不要了 --></style>
<!-- 然后将图片设置给启动Activity --> <activity android:name=".activity.SplashActivity"      android:theme="@style/SplashTheme"      android:screenOrientation="portrait">      <intent-filter>        <action android:name="android.intent.action.MAIN" />        <category android:name="android.intent.category.LAUNCHER" />      </intent-filter>    </activity>

以上就是对Android App启动白屏解决办法的实例详解,如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表