android開發之提高應用啟動速度_splash頁面瞬間響應_避免APP啟動閃白屏

來源:互聯網
上載者:User

標籤:highlight   初始化   解決   round   style   android   window   log   tar   

Application和Activity中的onCreate都進行了最佳化,基本沒有耗時操作,但是啟動應用之後還是會閃現一下白色背景,然後才進入Splash頁面,對比了一下QQ、、微博等用戶端,點擊之後都是瞬間響應Splash啟動頁,差別在哪裡呢。

其實就算你onCreate啥都不做,仍然會閃一下白屏,因為初始化解析介面時需要一定時間,解決方案是自訂Theme。

自訂如下

<style name="AppSplash" parent="android:Theme">        <item name="android:windowBackground">@drawable/ipod_bg</item>        <item name="android:windowNoTitle">true</item>    </style>  

 

設定檔中配置如下

<activity              android:theme="@style/AppSplash"             android:name=".SplashActivity" >  </activity>  

 


這樣一來,點擊應用表徵圖之後會馬上有響應,出現設定的背景圖片,跟QQ、效果一樣。

android開發之提高應用啟動速度_splash頁面瞬間響應_避免APP啟動閃白屏

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.