xml属性解析
来源:互联网 发布:淘宝助理4.6版下载 编辑:程序博客网 时间:2024/04/27 08:42
在Android项目中各种控件的xml属性大家都用过,例如android:key 可是这些属性在哪里可以找到?在源码中frameworks/base/core/res/res/values/attrs.xml中都可以找到,以Preference为例
<!-- Base attributes available to Preference. --> <declare-styleable name="Preference"> <!-- The key to store the Preference value. --> <attr name="key" format="string" /> <!-- The title for the Preference in a PreferenceActivity screen. --> <attr name="title" /> <!-- The summary for the Preference in a PreferenceActivity screen. --> <attr name="summary" format="string" /> <!-- The order for the Preference (lower values are to be ordered first). If this is not specified, the default orderin will be alphabetic. --> <attr name="order" format="integer" /> <!-- The layout for the Preference in a PreferenceActivity screen. This should rarely need to be changed, look at widgetLayout instead. --> <attr name="layout" /> <!-- The layout for the controllable widget portion of a Preference. This is inflated into the layout for a Preference and should be used more frequently than the layout attribute. For example, a checkbox preference would specify a custom layout (consisting of just the CheckBox) here. --> <attr name="widgetLayout" format="reference" /> <!-- Whether the Preference is enabled. --> <attr name="enabled" /> <!-- Whether the Preference is selectable. --> <attr name="selectable" format="boolean" /> <!-- The key of another Preference that this Preference will depend on. If the other Preference is not set or is off, this Preference will be disabled. --> <attr name="dependency" format="string" /> <!-- Whether the Preference stores its value to the shared preferences. --> <attr name="persistent" /> <!-- The default value for the preference, which will be set either if persistence is off or persistence is on and the preference is not found in the persistent storage. --> <attr name="defaultValue" format="string|boolean|integer|reference|float" /> <!-- Whether the view of this Preference should be disabled when this Preference is disabled. --> <attr name="shouldDisableView" format="boolean" /> </declare-styleable>如果想在xml中对这些属性进行设置代码如下
<Preference android:key="sn" android:textSize="17sp" android:title="@string/status_sn" android:summary="@string/device_info_not_available" android:persistent="false" />
而对这些属性的解析会定位到android.preference.Preference类中来
- xml属性解析
- androidmanifest.xml高级属性解析
- 简单解析xml属性值
- Android常用XML属性解析
- dom4j 解析 xml标签属性
- Android常见XML属性解析
- XML解析 获取节点属性
- Menu:Xml属性全解析
- C#解析带属性的XML
- dom4j解析xml获取attribute属性值
- JAXB 解析XML获取不到属性值
- 节点带有属性的xml pull解析
- 利用dom4j解析.xml之查询属性
- C#解析带属性的XML
- 解析xml,获取值和属性
- XML解析之----SAX解析(带属性与不带属性)----自定义Handler类
- 使用SAX解析XML实例--根据属性查找
- 将属性的XML解析成对象数组列表
- 乔布斯不为外界所知贡献:打造更环保的苹果
- 乔布斯的5个难解之谜
- 有关乔布斯健康问题关键时间和事件
- 7、XML数据类型的高级应用
- Runnable Thread 线程的实现
- xml属性解析
- 纽约时报:乔布斯最后的日子
- 由rand7生成rand10以及随机数生成方法的讨论
- 斐波那契数列算法分析
- 消息称乔布斯在家卧床观看了iPhone 4S发布会
- Java 关键字 Strictfp
- 科技行业众巨头哀悼史蒂夫乔布斯
- C语言类型修饰符 在这个上边吃大亏了啊 volatile
- GetRegisterAsBrowser CHtmlView::GetRegisterAsBrowser