View.post() 不靠谱的地方你知道多少

时间:2021-01-21 12:15:13
【文件属性】:
文件名称:View.post() 不靠谱的地方你知道多少
文件大小:406KB
文件格式:PDF
更新时间:2021-01-21 12:15:13
ie post st 一、前言 有时候,我们会需要用到 View.post() 方法,来将一个 Runnable 发送到主线程去执行。这一切,看似很美好,它最终会通过一个 Handler.post() 方法去执行,又避免我们重新定义一个 Handler 对象。 但是,从 Android 7.0(Api level 24) 开始,View.post() 将不再那么靠谱了,你 post() 出去的 Runnable ,可能永远也不会有机会执行到。 二、post 在 7.0 的差异 2.1 post 方法的差异 前面提到,这个问题只出现在 Android 7.0 上。那么就先从源码分析 Android 7.0 到底对 V

网友评论