开发者

Android Custom View - Optimizing Redrawing while Fling

I have a custom view that represents something like a photo-collage.

I need to support the following:

  1. Fling
  2. Zoom In
  3. Zoom Out

Here's what I currently do:

onDraw:

  1. Look out for the number of images to be drawn.
  2. Look out for the images to be drawn and their locations and angles
  3. If the image had been downloaded (from the server), draw it. Otherwise, draw some default image.

onTouch:

  1. action = DOWN: Record X,Y
  2. action = MOVE: Record X,Y; get the delta; 开发者_JAVA技巧record "new origins" and invalidate the UI.

This will result in redrawing the UI with latest images and coordinates.

However, this has serious performance problems when the images are still not downloaded the user stars flinging.

Is it possible to take a "snapshot" of the "view" and "pan" the "recorded image" during fling? And when the fling is complete, just update the UI with latest images?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜