您的位置:首页 > 移动开发 > Android开发

Android 系统自带 Theme(主题)

2014-12-01 15:48 239 查看
系统为我们提供了丰富的系统自带的Theme,当然,你也可以自定义Theme,前提是该Theme必须继承与某个已经存在地Theme,否则编译器会提示错误的。

1、 应用Theme属性两种方式

①、在AndroidManifest.xml文件中在<application/>或者<activity />节点设置android:theme属性.

②、直接在代码中调用方法setTheme()设置该Activity的主题,必须得在第一次调用setContentView()前设置。

常用的系统定义的Theme如下:

默认:



(1):android:theme="@android:style/Theme.Dialog" 将一个Activity显示为能话框模式



(2):android:theme="@android:style/Theme.NoTitleBar" 不显示应用程序标题栏



(3):android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 不显示应用程序标题栏,并全屏



(4):android:theme="Theme.Light" 背景为白色



(5):android:theme="Theme.Light.NoTitleBar" 白色背景并无标题栏



(6):android:theme="Theme.Light.NoTitleBar.Fullscreen" 白色背景,无标题栏,全屏



(7):android:theme="Theme.Black" 背景黑色



(8):android:theme="Theme.Black.NoTitleBar" 黑色背景并无标题栏



(9):android:theme="Theme.Black.NoTitleBar.Fullscreen" 黑色背景,无标题栏,全屏



(10):android:theme="Theme.Wallpaper" 用系统桌面为应用程序背景



(11):android:theme="Theme.Wallpaper.NoTitleBar" 用系统桌面为应用程序背景,且无标题栏



(12):android:theme="Theme.Wallpaper.NoTitleBar.Fullscreen" 用系统桌面为应用程序背景,无标题栏,全屏



(13):android:theme="Translucent" 透明背景



(14):android:theme="Theme.Translucent.NoTitleBar" 透明背景并无标题



(15):android:theme="Theme.Translucent.NoTitleBar.Fullscreen" 透明背景并无标题,全屏



(16):android:theme="Theme.Panel" 面板风格显示



(17):android:theme="Theme.Light.Panel" 平板风格显示



参考地址:
http://blog.csdn.net/xiaodongvtion/article/details/7873001 http://blog.chinaunix.net/uid-24448954-id-2846673.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: