随笔分类 - Android自定义view和控件
Android触摸事件分发的原理
摘要:一:前言 最近在学Android的触摸事件分发,我觉得网上说的太杂太乱,而且有很多博客都有明显的错误。什么自顶向下分发,自下向顶分发,什么拦截又一直消费什么什么之类,非常难懂。为了自己将来回顾可以更好的理解这块知识,也为了后来之人可以更好的学习,我写下这篇博客。 二:说在前面的知识 点击,滑动,松手
如何在子线程中更新UI
摘要:一:报错情况 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at androi
view 自定义 layout模板
摘要:class TagLayout(context: Context?, attrs: AttributeSet?) : ViewGroup(context, attrs) { private val childrenBounds = mutableListOf<Rect>()//用于存储摆放子view