開啓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自帶主題
1、android:theme="@android:style/Theme"
默認狀態,即如果theme這裏不填任何屬性的時候,默認爲Theme
2、android:theme="@android:style/Theme.NoDisplay"
任何都不顯示。比較適用於只是運行了activity,但未顯示任何東西
3、android:theme="@android:style/Theme.NoTitleBar“
背景主題的沒有標題欄的樣式
4、android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
背景主題的沒有標題欄且全屏的樣式
5、android:theme="@android:style/Theme.Black"
默認狀態下黑背景
6、android:theme="@android:style/Theme.Black.NoTitleBar"
黑背景主題的沒有標題欄的樣式
7、android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
黑背景主題的沒有標題欄且全屏的樣式
8、android:theme="@android:style/Theme.Light"
默認狀態下亮背景,與上述黑背景Theme.Black相反
9、android:theme="@android:style/Theme.Light.NoTitleBar"
亮背景主題的沒有標題欄的樣式,與Theme.Black.NoTitleBar相反
10、android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"
亮背景主題的沒有標題欄且全屏顯示的樣式,與Theme.Black.NoTitleBa.Fullscreenr相反
11、android:theme="@android:style/Theme.Dialog"
對話框樣式 將整個activity變成對話框樣式出現
12、android:theme="@android:style/Theme.InputMethod"
Window animations that are applied to input method overlay windows
13、android:theme="@android:style/Theme.Panel"
刪除掉所有多餘的窗口裝飾,在一個空的矩形框中填充內容,作用範圍相當於把dialog中的所有元素全部去掉,只是一個空的矩形框,且此爲默認的樣式
14、android:theme="@android:style/Theme.Light.Panel"
刪除掉所有多餘的窗口裝飾,在一個空的矩形框中填充內容,作用範圍相當於把dialog中的所有元素全部去掉,只是一個空的矩形框,且默認是light的樣式
15、android:theme="@android:style/Theme.Wallpaper"
使用牆紙做主題,默認狀態。
16、android:theme="@android:style/Theme.WallpaperSettings"
使用牆紙做主題,默認是使用將上一個界面調暗之後作爲主題
17、android:theme="@android:style/Theme.Light.WallpaperSettings"
使用牆紙做主題,默認Light狀態
18、android:theme="@android:style/Theme.Wallpaper.NoTitleBar"
使用牆紙做主題,且沒有標題欄
19、android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
使用牆紙做主題,且沒有標題欄,且全屏顯示
20、android:theme="@android:style/Theme.Translucent"
半透明狀態下的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。
21、android:theme="@android:style/Theme.Translucent.NoTitleBar"
半透明狀態下沒有標題欄的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。
22、android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
半透明狀態下沒有標題欄且全屏的背景,將運行此activity之前的屏幕作爲半透明狀態作爲此activity運行時的樣式。
引用:http://blog.csdn.net/hongya1109110121/article/details/11985545