关于Android的style和theme
来源:互联网 发布:北大青鸟软件培训中心 编辑:程序博客网 时间:2024/06/05 09:51
style是什么?
A style is a collection of properties that specify the look and format for a View or window. A style can specify properties such as height, padding, font color, font size, background color, and much more. A style is defined in an XML resource that is separate from the XML that specifies the layout.
来自developer.android翻译一下
style是指定视图或窗口的外观和格式属性的集合。样式可以指定诸如高度,填充,字体颜色,字体大小,背景颜色,以及更多的特性。style是在从指定布局XML单独的XML资源定义。
举个栗子
<?xml version="1.0" encoding="utf-8"?><resources><style name="CodeFont" parent="@android:style/TextAppearance.Medium"><item name="android:layout_width">fill_parent</item><item name="android:layout_height">wrap_content</item><item name="android:textColor">#00FF00</item><item name="android:typeface">monospace</item></style></resources>
<TextViewstyle="@style/CodeFont"android:text="@string/hello" />
style作用?
- 设计与内容分开
- 可继承
- 便于统一风格
style如何书写?
↑↑↑看上面的栗子↑↑↑
关于继承系统的书写
<style name="CodeFont" parent="@android:style/TextAppearance.Medium">...</style>
关于继承自定义的书写
<style name="CodeFont1" parent="CodeFont">...</style>
关于继承系统theme的书写
<style name="LightThemeSelector" parent="android:Theme.Holo.Light">...</style><style name="LightThemeSelector" parent="@android:style/Theme.Holo.Light">...</style>
关于继承自定义theme的书写
<style name="LightThemeSelector" parent="@style/Theme.AppCompat">...</style>
style与theme的区别?
- Theme是针对窗体级别的,改变窗体样式;
- Style是针对窗体元素级别的,改变指定控件或者Layout的样式。
系统自带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:theme=”Theme.Wallpaper.NoTitleBar” : 用系统桌面为应用程序背景,且无标题栏
android:theme=”Theme.Wallpaper.NoTitleBar.Fullscreen” : 用系统桌面为应用程序背景,无标题栏,全屏
android:theme=”Theme.Translucent : 透明背景
android:theme=”Theme.Translucent.NoTitleBar” : 透明背景并无标题
android:theme=”Theme.Translucent.NoTitleBar.Fullscreen” : 透明背景并无标题,全屏
android:theme=”Theme.Panel “: 面板风格显示
android:theme=”Theme.Light.Panel” : 平板风格显示
theme的一些属性
- 关于Android的style和theme
- Android的Style和Theme
- 关于android的一些默认的系统style和theme
- 关于theme 和style的一些总结
- Android:Theme 和 style
- android style和theme
- Android:Style和Theme
- Android Style和Theme
- android:style和theme
- android的style和theme的区别
- Android中Style和Theme的使用
- Android中Style和Theme的使用
- Android中Style和Theme的使用
- Android中Style和Theme的使用
- Android中Theme和Style的应用
- Android中Style和Theme的使用
- android 中 style和theme的区别
- Android中Theme和Style的使用
- iOS UINavigationController代理方法实现自定义
- su: 无法设置用户ID: 资源暂时不可用
- HashSet和HashMap比较
- http接口调用
- IOS更改UITabBarItem的图片及字体颜色
- 关于Android的style和theme
- Memcache+Spring AOP
- C++中auto型的详细解释
- FZU 2236 第十四个目标(严格上升子序列个数 离散化 + 树状数组)
- Linux下查看文件和文件夹大小
- lua select(a,b)函数
- 反射访问方法
- _cdel和thiscall调用约定
- UISearchController IOS8之后推荐使用的搜索控件