码迷,mamicode.com
首页 > 其他好文 > 详细

自定义属性提取源码分析

时间:2015-10-03 21:52:06      阅读:206      评论:0      收藏:0      [点我收藏+]

标签:

源码分析基于Android 5.0,自定义View的使用示例如下:
技术分享
其中attrs标识CustomTitleView对应的节点属性集合:
技术分享
obtainStyledAttributes的作用是将attrs属性集合中<declare-styleable name=“CustomTitleView”/>
指定的部分的属性进行封装,属于container的角色,调用过程如下:
技术分享
技术分享
技术分享
因此typedArray的mData和mIndices的size由int[] attrs决定,再来看下typeArray读取字串属性的过程:
技术分享
技术分享
技术分享
技术分享
技术分享
可以看到mData是分段存储索引信息的,如数据索引字段从AssetManager.STYLE_DATA(6)开始,具体字串值需通过native调用获取。 

自定义属性提取源码分析

标签:

原文地址:http://www.cnblogs.com/tonybright/p/4853822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!