其實(shí)Android在V4包里,已經(jīng)原生支持圓角圖片了:
不知道的小伙伴趕緊準(zhǔn)備一下小板凳,聽我細(xì)細(xì)說來:
RoundedBitmapDrawable shopDrawable = RoundedBitmapDrawableFactory.create(
getResources(), getAssets().open("shop_image.png"));
//在v4 以前的版本中,使用此方法可以設(shè)置 圖片為圓角
shopDrawable.setCornerRadius(Integer.MAX_VALUE);
//在v4 新版本中,直接提供了方法設(shè)置圓角,代碼其實(shí)和上面的是一樣的
shopDrawable.setCircular(true);
//直接設(shè)置,就可以啦...
imageView.setBackgroundDrawable(shopDrawable);
是不是很簡單?
如果你只是為了一個圓角而使用第三方j(luò)ar包,是不是很奢侈?
至此: 文章就結(jié)束了,如有疑問: QQ群:274306954 歡迎您的加入.