zoukankan      html  css  js  c++  java
  • android invalidate和postinvalidate源码分析

    postinvalidate源码分析

    view中

    public void postInvalidate() {
            postInvalidateDelayed(0);
        }
    
        public void postInvalidateDelayed(long delayMilliseconds) {
            // We try only with the AttachInfo because there's no point in invalidating
            // if we are not attached to our window
            final AttachInfo attachInfo = mAttachInfo;
            if (attachInfo != null) {
                attachInfo.mViewRootImpl.dispatchInvalidateDelayed(this, delayMilliseconds);
            }
        }
    
    
        public void dispatchInvalidateDelayed(View view, long delayMilliseconds) {
            Message msg = mHandler.obtainMessage(MSG_INVALIDATE, view);
            mHandler.sendMessageDelayed(msg, delayMilliseconds);
        }
    
    
      switch (msg.what) {
                case MSG_INVALIDATE:
                    ((View) msg.obj).invalidate();
                    break;
    

    其他的和invalidate一样,着我们就可以看到了,postinvalidate在主线程和非主线程中都可以调用,但是Invalidate不能直接在线程中调用



    作者:Peakmain
    链接:https://www.jianshu.com/p/6c5d65009ba1
  • 相关阅读:
    java 基础7
    java 基础5
    java 基础6
    java 基础4
    java 基础2
    java 基础3
    java 基础1
    使用HTML的基本结构创建网页
    jsp Servlet 文件上传
    Filter过滤器 不登陆无法访问其他页面
  • 原文地址:https://www.cnblogs.com/l-h-h/p/10330403.html
Copyright © 2011-2022 走看看