每天读文档
来源:互联网 发布:上古卷轴5大叔捏脸数据 编辑:程序博客网 时间:2024/06/06 07:13
Styles and Themes
设计初衷:they allow you to separate the design from the content.
Defining Styles
<?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>
规范1:To create a set of styles, save an XML file in the res/values/
directory of your project. The name of the XML file is arbitrary, but it must use the.xml
extension and be saved in the res/values/
folder
必须为放到指定文件目录res/values/下的xml文件,文件名任意
规范2:The root node of the XML file must be <resources>
.For each style you want to create, add a<style>
element to the file with a name
that uniquely identifies the style (this attribute is required). Then add an<item>
element for each property of that style, with a name
that declares the style property and a value to go with it (this attribute is required). The value for the<item>
can be a keyword string, a hex color, a reference to another resource type, or other value depending on the style property. Here's an example file with a single style:
用<resources>作为文件的根节点,用<style>作为一个style的跟节点,内部定义若干<item>键值对,值可以为字符串,16进制颜色或者其他的资源文件
Inheritance
注意1:You can use this to inherit properties from an existing style and then define only the properties that you want to change or add.
可以继承父类主题然后只修改你想修改的属性
注意2:If you want to inherit from styles that you've defined yourself, you do not have to use theparent
attribute.
继承自己的主题不需要写parent
<style name="CodeFont.Red"> <item name="android:textColor">#FF0000</item> </style>
You can't inherit Android built-in styles this way
但是仅限于继承你自定义的主题
Style Properties
View
is the corresponding class reference, which lists all of the supported XML attributesView
class for supported style properties. However, if you apply a style to a View that does not support all of the style properties, the View will apply only those properties that are supported and simply ignore the others.R.attr
reference for attributes that begin withwindow
.Applying Styles and Themes to the UI
ViewGroup
, the childView
elements willnot inherit the style properties—only the element to which you directly apply the style will apply its properties. However, youcan apply a style so that it applies to all View
elements—by applying the style as a theme.Activity
or application in the Android manifest.Select a theme based on platform version
res/values-v11
, but make the parent theme the holographic theme:<style name="LightThemeSelector" parent="android:Theme.Light"> ...</style><style name="LightThemeSelector" parent="android:Theme.Holo.Light"> ...</style>
不同的文件夹(按一定规则命名),相同的style名,不同的父类。来实现在不同系统版本上的自动切换
- 每天读文档
- 文档整理每天都要做
- flask使用文档<一> ----------每天翻译一点点
- 每天学点java—文档注释
- 设计文档的心得——每天进步一点点
- 每天读一篇
- 每天一读
- 每天一读
- 每天一读
- 每天读点《道德经》
- 每天
- 每天
- 每天
- 每天
- 每天
- 读《每天为自己打个钩》
- 每天读一点好玩心理学
- 今天开学Oralce 现在坚持每天写技术文档,也就是笔记了!!
- Android Service 的介绍与基本使用
- Spark Streaming实时计算框架介绍
- Laravel整合UEditor编辑器使用阿里云OSS存储(二)改造UEditor上传OSS
- 实时流计算Spark Streaming原理介绍
- Android 实现ListView的A-Z字母排序和过滤搜索功能,实现汉字转成拼音
- 每天读文档
- 实时流计算Spark Streaming原理介绍
- 四大组件之BroadcastReceiver
- ubuntu 下安装intel realsense驱动
- Spark Streaming:大规模流式数据处理
- 汉字验证码算法
- SparkStream demo
- 恢复格式化硬盘数据之前的QQ聊天记录
- 滑动窗口 TOPN 技术实现演变