android xml 属性收集

来源:互联网 发布:qq飞车飞碟数据 编辑:程序博客网 时间:2024/05/29 19:52

集中一下看代码时遇到的一些我认为特殊的属性。

1. android:divider="?android:attr/dividerVertical"

    android:showDividers="end"

    android:dividerPadding="12dp"

这三个一看就是设置分割线的。意思一看就懂。

2. android:duplicateParentState="true"

设置为 true 的话,将直接从父容器中获取绘图状态(光标,按下等)。注意仅仅是获取状态,而不是事件。也就是你点击一下 LinearLayout 时 Button 有点击效果,但不执行点击事件。

3. Styles and Themes from google Document

1). A Style is a collection of properties that specify the look and format for a view or a window.

2). A Theme is a style applied to an entire activity or application,rather than an individual view. when a style is applied as a theme, every view in the activity or application will apply each style property that it supports.

3). 在 res/values 文件中创建一个 xml 文件即可定义 style,文件的名字随意。该 xml 文件的根节点必须是 <resources> 。each child of the <resources> element is converted into an application resource object at compile-time.

4). 如果一个自定义的 style B 要继承自定义的 style A ,可以不用 parent 属性,而直接将 B 命名为 A.B 即可。

5). 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.

6). if a style is applied to a viewgroup, the child view elements will not inherit the style properties, only the element to which you directly apply the style will apply its properties.