lshare

1. 去除启动黑屏

1.1 在style.xml中定义两种主题:

<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
   <item name="android:windowIsTranslucent">true</item>
</style>

<style name="AppTheme.Splash">
   <item name="android:windowIsTranslucent">false</item>
   <item name="android:windowBackground">@drawable/bg_splash</item>
</style>

1.2 在AndroidManifest.xml中设置MainActivity的主题为AppTheme.Splash

<activity
  android:name="xxx.MainActivity"
  android:icon="@mipmap/ic_launcher"
  android:theme="@style/AppTheme.Splash">
  <intent-filter>
      <action android:name="android.intent.action.MAIN"/>
      <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
</activity>

1.3 在MainActivityonCreate调用super的方法之前设置回原先的主题

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
  }

2. 分析启动卡顿

分类:

技术点:

相关文章:

  • 2021-09-10
  • 2021-11-23
  • 2019-09-17
  • 2021-04-11
  • 2021-09-08
  • 2021-08-20
  • 2021-09-20
  • 2021-09-08
猜你喜欢
  • 2021-09-10
  • 2021-08-21
  • 2021-09-10
  • 2021-09-20
  • 2021-09-10
  • 2022-01-03
相关资源
相似解决方案