在Android的位图的圆形作物 [英] bitmap circular crop in android

查看:206
本文介绍了在Android的位图的圆形作物的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有显示半透明圈下的一个方形位图。用户可触摸并拖动位图定位。我希望能够裁剪位图的一部分,曾经是圆下。我怎样才能做到这一点?

i have a square bitmap being displayed underneath a semi transparent circle. The user can touch and drag the bitmap to position it. I want to be able to crop what ever part of the bitmap is under the circle. How can i do this?

推荐答案

看看<一个href=\"http://developer.android.com/reference/android/support/v4/graphics/drawable/RoundedBitmapDrawable.html\">RoundedBitmapDrawable在支持库

你所要做的就是把位图和圆角半径

all you have to do is give it the bitmap and the corner radius

RoundedBitmapDrawable img = RoundedBitmapDrawableFactory.create(getResources(),bitmap);
img.setCornerRadius(radius);

imageView.setImageDrawable(img);

这篇关于在Android的位图的圆形作物的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆