requestLayout, invalidate和postInvalidate的异同

requestLayout

当一个VIEW的布局属性发生了变化的时候,可以调用该方法,让父VIEW调用onmeasure 和onlayout重新定位该view的位置,需要在UI线程调用

 

invalidate

强制使view重绘,需要在UI线程调用

 

postinvalidate

作用同上,但是可以直接在子线程调用

 

u3coding
A software developer

Leave a Comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.