![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
源码
普通网友
这个作者很懒,什么都没留下…
展开
-
LayoutInflater源码解析
android.view.LayoutInflater是布局解析的主要类,包括setContentView也是走的LayoutInflater。LayoutInflater解析布局主要入口就是inflate()方法,我们就从inflate(int resource, ViewGroup root, boolean attachToRoot)方法开始分析。inflate(int resource, V原创 2016-07-23 02:15:11 · 209 阅读 · 0 评论 -
SparseArray解析
SparseArray是android V4包中提供的工具类,在某些场景下,可以用来替代Hashmap进行对象的存储,其内部实现了一个矩阵压缩算法,可以进行矩阵压缩,大大减少了存储空间,节约内存。此外它的查找算法是二分法,提高了查找的效率。SparseArray的value可以是任意类型,但key只能是Integer、Long类型。所以在key为Integer、Long的场景下,SparseArr原创 2016-07-23 02:32:53 · 1015 阅读 · 0 评论 -
HashMap、ArrayMap、SparseArray分析比较
一、原理分析 1、HashMap分析 HashMap是基于hash表非同步map实现,key和value都可以为null。其hash表实现方式是”拉链法”,可理解为链表的数组,如下图所示: HashMap部分源码如下:/** * The hash table. If this hash map contains a mapping for null, it is * not re原创 2016-08-15 18:19:26 · 6754 阅读 · 1 评论