【Android面試】關於post你真的瞭解嗎?

思考:view.post()和handler.post()有什麼區別? 有時候我們在onCreat裏面無法獲取到控件寬高,調用view.post()就可以獲取到了。爲什麼呢? 下面是view.post()源碼 可見當View已經attach到window,直接調用UI線程的Handler發送runnable。如果View還未attach到window,將runnable放入ViewRootImpl
相關文章
相關標籤/搜索