Android:启动页有短暂白屏的解决方法

导致原因

theme用的是Theme.AppCompat.Light.NoActionBar:

    <application        android:name=".application.MyApplication"        android:allowBackup="true"        android:icon="@drawable/logo"        android:label="@string/app_name"        android:roundIcon="@mipmap/ic_launcher_round"        android:supportsRtl="true"        android:theme="@style/Theme.AppCompat.Light.NoActionBar"        tools:replace="icon, label, theme">

解决办法

添加一个新的style:

        <activity            android:name=".activity.SplashActivity"            android:screenOrientation="portrait"            android:theme="@style/styleSplash">            <intent-filter>                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />            </intent-filter>        </activity>

style中windowIsTranslucent属性设置为true,背景透明:

    <style name="styleSplash" parent="Theme.AppCompat.Light.NoActionBar">        <item name="android:windowIsTranslucent">true</item>        <item name="android:windowNoTitle">true</item>    </style>

更多相关文章

  1. android > 设置button 背景颜色
  2. 修改dialog背景以及代码扩展AlertDialog和tint的使用
  3. android 之 布局属性--RelativeLayout
  4. android动态给view设置可见、不可见属性
  5. Android 动态设置布局属性

随机推荐

  1. 可以在SELECT语句中嵌入描述语法吗?
  2. MySQL判断索引存在并删除索引的存储过程
  3. Linux上跑MySQL优化技巧
  4. 如何知道php脚本中的名称是指mysql表还是
  5. 获取特定行的索引
  6. Jsp+javaBean+mysql的网络云盘
  7. SQLSTATE [HY000] [2002]没有这样的文件
  8. Mysql数据库存储引擎
  9. mysql中文乱码彻底解决
  10. 远程连接Linux虚拟机上的mysql失败的解决