开发者

Android: grab a piece of an ImageView

I have an ImageView from which I want to copy a piece of it in the shape of a circle that I can then re-display to the user at a larger than original size to simulate a zoom effec开发者_开发技巧t. Would I use bitmaps for that? Thanks.


Yes.... you can try to get a Bitmap that represents the ImageView you are working with. Before, you have to enable the caching (by invoking the setDrawingCacheEnabled(true) method). To get the Bitmap representation of the image, you can use the getDrawingCache() method.

Once you get that Bitmap, you can resize it or make any other changes you want. Then, you can create a Rect object with the portion of the bitmap you want to draw, then you draw that rect using this method: drawBitmap(Bitmap, Rect origin, Rect destination, Paint).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜