啓動app閃屏問題以及Android自帶主題

開啓Android應用,有時會出現閃屏現象,在此列出三種解決方案:

1、修改主題

設置當前主題爲:@android:style/Theme.Translucent (透明背景)

2、修改當前主題屬性:

在當前主題中添加如下透明屬性:

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

3、自定義主題,設置背景圖片

   <style name="MyNewTheme" parent="@android:style/Theme">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
         <item name="android:windowBackground">@drawable/bg</item>
    </style>

 

Android自帶主題

1android:theme="@android:style/Theme"

默認狀態,即如果theme這裏不填任何屬性的時候,默認爲Theme

2android:theme="@android:style/Theme.NoDisplay"

任何都不顯示。比較適用於只是運行了activity,但未顯示任何東西

3android:theme="@android:style/Theme.NoTitleBar“

背景主題的沒有標題欄的樣式

4android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

背景主題的沒有標題欄且全屏的樣式

5android:theme="@android:style/Theme.Black"

默認狀態下黑背景

6android:theme="@android:style/Theme.Black.NoTitleBar"

黑背景主題的沒有標題欄的樣式

7android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"

黑背景主題的沒有標題欄且全屏的樣式

8android:theme="@android:style/Theme.Light"

默認狀態下亮背景,與上述黑背景Theme.Black相反

9android:theme="@android:style/Theme.Light.NoTitleBar"

亮背景主題的沒有標題欄的樣式,與Theme.Black.NoTitleBar相反

10android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"

亮背景主題的沒有標題欄且全屏顯示的樣式,與Theme.Black.NoTitleBa.Fullscreenr相反

11android:theme="@android:style/Theme.Dialog"

對話框樣式 將整個activity變成對話框樣式出現

12android:theme="@android:style/Theme.InputMethod"

Window animations that are applied to input method overlay windows

13android:theme="@android:style/Theme.Panel"

刪除掉所有多餘的窗口裝飾,在一個空的矩形框中填充內容,作用範圍相當於把dialog中的所有元素全部去掉,只是一個空的矩形框,且此爲默認的樣式

14android:theme="@android:style/Theme.Light.Panel"

刪除掉所有多餘的窗口裝飾,在一個空的矩形框中填充內容,作用範圍相當於把dialog中的所有元素全部去掉,只是一個空的矩形框,且默認是light的樣式

15android:theme="@android:style/Theme.Wallpaper"

使用牆紙做主題,默認狀態。

16android:theme="@android:style/Theme.WallpaperSettings"

使用牆紙做主題,默認是使用將上一個界面調暗之後作爲主題

17android:theme="@android:style/Theme.Light.WallpaperSettings"

使用牆紙做主題,默認Light狀態

18android:theme="@android:style/Theme.Wallpaper.NoTitleBar"

使用牆紙做主題,且沒有標題欄

19android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"

使用牆紙做主題,且沒有標題欄,且全屏顯示

20android:theme="@android:style/Theme.Translucent"

半透明狀態下的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。

21android:theme="@android:style/Theme.Translucent.NoTitleBar"

半透明狀態下沒有標題欄的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。

22android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"

半透明狀態下沒有標題欄且全屏的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。

 引用:http://blog.csdn.net/hongya1109110121/article/details/11985545

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章