Android 程式啟動時的黑屏或者白屏問題

來源:互聯網
上載者:User

應用在初次啟動的時候有黑屏閃過(或者白屏),因為系統預設的theme(主題裡設定了顏色)設定了啟動時的北京顏色。那麼怎麼能改變一下,讓它變的好看點呢?

看了很多,發現stackoverflow.com上有很多好東西啊。前一段時間有人說學會了Google,Stackoverflow.com,就不愁寫代碼了。資源太多了。

消除activity啟動時的初始白屏或黑屏問題

1. style.xml中中增加

    <style name="AppTheme" parent="android:Theme.Holo.Light">

        <item name="android:windowIsTranslucent">true</item>

        <item name="android:windowNoTitle">true</item>

        <item name="android:windowActionBar">false</item>

        <item name="android:windowBackground">@android:color/transparent</item>

    </style>

2 acvitiy 的屬性中加上

  android:theme="@style/AppTheme" 

Android 解決程式啟動時的黑屏問題

http://www.eoeandroid.com/forum.php?mod=viewthread&tid=208904&fromuid=511991

http://www.cnblogs.com/loulijun/archive/2013/04/09/3010318.html

http://www.linuxidc.com/Linux/2012-02/53064.htm

http://www.cnblogs.com/U-tansuo/archive/2013/03/27/U_tansuo-android.html

http://stackoverflow.com/questions/10292708/change-application-background-image

http://stackoverflow.com/questions/9535695/dynamically-find-the-theme-name-in-android-application/9537629#9537629

http://stackoverflow.com/questions/14425868/whats-the-difference-between-windowbackground-and-background-for-activities-sty

http://android-developers.blogspot.co.il/2009/03/window-backgrounds-ui-speed.html

http://stackoverflow.com/questions/10173158/android-custom-theme-different-theme-for-landscape-and-portrait-mode

http://blog.sina.com.cn/s/blog_6004d60d0101i1er.html(所有樣式請參考\sdk\docs\reference\android\R.attr.html)

注意看這裡的onCreate中的setContentView()後面的那句話:

http://code.google.com/p/shelves/source/browse/trunk/Shelves/src/org/curiouscreature/android/shelves/activity/ShelvesActivity.java

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.