How does ImageView just redraw part of its content when invalidate(Rect) is called?

Posted by imax366 on Stack Overflow See other posts from Stack Overflow or by imax366
Published on 2010-04-06T02:16:38Z Indexed on 2010/04/06 2:23 UTC
Read the original article Hit count: 299

Filed under:
|

Hi, guys I am new to Android development, just reading docs and trying the APIs. I am quit confused how ImageView managed to draw just a part of its content after an invalidate(Rect) invocation.

I've checked ImageView.java, found no other drawing method except onDraw(Canvas), but onDraw(Canvas) only cut the drawable only if it is beyound the view's visible boundary. I also read the implementation of View.invalidate(Rect), I think the key of this function is calling to mParent.invalidateChild(this, r); However, I think the parent view doesn't know how to draw the child in the given Rect, it finally has to call some method of it child to paint out.

Has anybody investigated this part of codes? Would you please give me some guide?

© Stack Overflow or respective owner

Related posts about view

Related posts about invalidate