开发者

Android: How to center crop images without scaling

I have some images I want to show in thumbnails, and I want them to center crop and not scale. The images themselves are almost always rectangular, and I want to crop them around their center and have them fit into a square ImageView. The bitmaps themselves either have a height that matches the size 开发者_StackOverflow中文版of the ImageView, or a width that matches. So essentially I just want to crop off the left/right or the top/bottom of each photo, and not lose any quality.

When I try to use ScaleType.CENTER_CROP my images are becoming blurry. Any suggestions?


You should just use ScaleType.CENTER. This will perform no scaling, it will just center the image behind the image frame. Anything falling outside the ImageView will be cropped.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜