Android自带theme如下:
•android:theme="@android:style/Theme.Dialog" 将一个Activity显示为对话框模式
•android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏
•android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏
•android:theme="Theme.Light" 背景为白色
•android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏
•android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏
•android:theme="Theme.Black" 背景黑色
•android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏
•android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏
•android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景 (Android 2.0以上, API 5以上才支持)
•android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏
•android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏
•android:theme="Translucent" 背景透明
•android:theme="Theme.Translucent.NoTitleBar" 背景透明 并无标题栏
•android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 背景透明 并无标题栏 ,全屏
•android:theme="Theme.Panel" 面板风格
•android:theme="Theme.Light.Panel" 白色面板
我将api中theme分为两种类型来实验;一种是api Level为11的,一种是11以下的。level为11的用的是3.0的模拟器,11以下用的是N1,2.3.3的系统。
这里我是统一将theme写在AndroidManifest.xml中定义,如下图:
先总结level为11以下的theme:
1、Theme:
它的意思为默认状态,即如果theme这里不填任何属性的时候,默认为Theme。
api原文为:
The default system theme. This is the theme used for activities that have not explicitly set their own theme.
You can count on this being a dark background with light text on top, but should try to make no other assumptions about its appearance. In particular, the text inside of widgets using this theme may be completely different, with the widget container being a light color and the text on top of it a dark color.
效果图如下:
1.1、Theme_NoDisplay
它的意思为任何都不显示。比较适用于只是运行了activity,但未显示任何东西。
api原文如下:
Default theme for activities that don’t actually display a UI; that is, they finish themselves before being resumed.
效果图如下:
1.2、Theme_NoTitleBar
意思为:背景主题的没有标题栏的样式,默认如果没有设置的话,显示黑背景
api原文:
Variant of the default (dark) theme with no title bar
效果图如下:
1.3、Theme_NoTitleBar_Fullscreen
意思为:背景主题的没有标题栏且全屏的样式,默认为黑背景
api原文:
Variant of the default (dark) theme that has no title bar and fills the entire screen
效果图如下:
2、Theme_Black:
它的意思为默认状态下黑背景。
api原文如下:
Special variation on the default theme that ensures the background is completely black. This is useful for things like image viewers and media players. If you want the normal (dark background) theme do not use this, use Theme
.
效果图如下:
2.1、Theme_Black_NoTitleBar:
意思为:黑背景主题的没有标题栏的样式
api原文:
Variant of the black theme with no title bar
效果图如下:
2.2、Theme_Black_NoTitleBar_Fullscreen
意思为:黑背景主题的没有标题栏且全屏的样式
api原文:
Variant of the black theme that has no title bar and fills the entire screen
效果图如下:
3、Theme_Light
意思为:默认状态下亮背景,与上述黑背景Theme_Black相反。
api原文:
Theme for a light background with dark text on top. Set your activity to this theme if you would like such an appearance. As with the default theme, you should try to assume little more than that the background will be a light color.
效果图如下:
3.1、Theme_Light_NoTitleBar
意思为:亮背景主题的没有标题栏的样式,与Theme_Black_NoTitleBar相反
api原文:
Variant of the light theme with no title bar
效果图如下:
3.2、Theme_Light_NoTitleBar_Fullscreen
意思为:亮背景主题的没有标题栏且全屏显示的样式,与Theme_Black_NoTitleBa_Fullscreenr相反
api原文:
Variant of the light theme that has no title bar and fills the entire screen
效果图如下:
4、Theme_Dialog
意思为:对话框样式 将整个activity变成对话框样式出现。
api原文:
Default theme for dialog windows and activities, which is used by the Dialog
class. This changes the window to be floating (not fill the entire screen), and puts a frame around its contents. You can set this theme on an activity if you would like to make an activity that looks like a Dialog.
效果图如下:这里需要自定义大小,否则显示不全。
5、Theme_InputMethod
6、Theme_Panel
意思为:删除掉所有多余的窗口装饰,在一个空的矩形框中填充内容,作用范围相当于把dialog中的所有元素全部去掉,只是一个空的矩形框,且此为默认的样式。
api原文:
Default dark theme for panel windows. This removes all extraneous window decorations, so you basically have an empty rectangle in which to place your content. It makes the window floating, with a transparent background, and turns off dimming behind the window.
效果图如下:这里需要自定义大小,否则显示不全。
6.1、Theme_Light_Panel
意思为:删除掉所有多余的窗口装饰,在一个空的矩形框中填充内容,作用范围相当于把dialog中的所有元素全部去掉,只是一个空的矩形框,且默认是light的样式。
api原文:
Default light theme for panel windows. This removes all extraneous window decorations, so you basically have an empty rectangle in which to place your content. It makes the window floating, with a transparent background, and turns off dimming behind the window.
效果图如下:这里需要自定义大小,否则显示不全。
7、
Theme_Wallpaper
意思为:使用墙纸做主题,默认状态。
api原文:
Default theme for windows that want to have the user’s selected wallpaper appear behind them.
效果图如下:
7.1、Theme_WallpaperSettings
意思为:使用墙纸做主题,默认是使用将上一个界面调暗之后作为主题,(这里我很疑惑为什么是上一个界面变暗而不是墙纸主题变暗呢?)
api原文:
Theme for a wallpaper’s setting activity that is designed to be on top of a dark background.
效果图如下:
7.2、Theme_Light_WallpaperSettings
意思为:使用墙纸做主题,默认Light状态。
api原文:
Theme for a wallpaper’s setting activity that is designed to be on top of a light background.
效果图如下:
7.3、Theme_Wallpaper_NoTitleBar
意思为:使用墙纸做主题,且没有标题栏
api原文:
Variant of the translucent theme with no title bar
效果图如下:
7.4、Theme_Wallpaper_NoTitleBar_Fullscreen
意思为:使用墙纸做主题,且没有标题栏,且全屏显示
api原文:
Variant of the translucent theme that has no title bar and fills the entire screen
效果图如下:
8、Theme_Translucent
意思为:半透明状态下的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。
api原文:
Default theme for translucent activities, that is windows that allow you to see through them to the windows behind. This sets up the translucent flag and appropriate animations for your windows.
效果图如下:
8.1、Theme_Translucent_NoTitleBar
意思为:半透明状态下没有标题栏的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。
api原文:
Variant of the translucent theme with no title bar
效果图如下:
8.2、Theme_Translucent_NoTitleBar_Fullscreen
意思为:半透明状态下没有标题栏且全屏的背景,将运行此activity之前的屏幕作为半透明状态作为此activity运行时的样式。
api原文:
Variant of the translucent theme that has no title bar and fills the entire screen
效果图如下: