Android避免启动时闪一下黑屏

来源:互联网 发布:贪心算法的设计思想 编辑:程序博客网 时间:2024/05/14 09:08

1.设定主题,此主题为透明的,加入到res/values/styles.xml中:

[html] view plaincopy在CODE上查看代码片派生到我的代码片
  1. <style name="Theme.AppStartLoadTranslucent" parent="android:Theme">    
  2.             <item name="android:windowIsTranslucent">true</item>   
  3.         <item name="android:windowNoTitle">true</item>    
  4. </style>  

2.设定android启动时使用此主题,在AndroidManifest.xml中设定:

[html] view plaincopy在CODE上查看代码片派生到我的代码片
  1. <application  
  2.         android:allowBackup="true"  
  3.         android:icon="@drawable/ic_launcher"  
  4.         android:label="@string/app_name"  
  5.         android:theme="@style/Theme.AppStartLoadTranslucent"  
  6.         >  
  7.         <activity android:name=".MainActivity" android:label="@string/app_name">  
  8.             <intent-filter>  
  9.                  <action android:name="android.intent.action.MAIN" />    
  10.                  <category android:name="android.intent.category.LAUNCHER" />    
  11.             </intent-filter>  
  12.         </activity>  
  13.     </application>  
0 0
原创粉丝点击