随笔分类 -  Android自定义view和控件

摘要:一:前言 最近在学Android的触摸事件分发,我觉得网上说的太杂太乱,而且有很多博客都有明显的错误。什么自顶向下分发,自下向顶分发,什么拦截又一直消费什么什么之类,非常难懂。为了自己将来回顾可以更好的理解这块知识,也为了后来之人可以更好的学习,我写下这篇博客。 二:说在前面的知识 点击,滑动,松手 阅读全文
posted @ 2022-01-06 23:52 ou尼酱~~~ 阅读(102) 评论(0) 推荐(0)
摘要:一:报错情况 android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at androi 阅读全文
posted @ 2021-12-14 17:09 ou尼酱~~~ 阅读(432) 评论(2) 推荐(0)
摘要:class TagLayout(context: Context?, attrs: AttributeSet?) : ViewGroup(context, attrs) { private val childrenBounds = mutableListOf<Rect>()//用于存储摆放子view 阅读全文
posted @ 2021-12-13 16:36 ou尼酱~~~ 阅读(106) 评论(1) 推荐(0)