1. 程式人生 > >給ImageView動態設定圓角

給ImageView動態設定圓角

現在需求就是在同一個ImageView上面有的顯示圓形圖示,有的顯示方形圖示,不能再xml佈局中寫成CircleImageView,所以就需要動態設定圓形:

導包:api 'com.github.bumptech.glide:glide:4.5.0'

RequestOptions requestOptions = RequestOptions.circleCropTransform();
Glide.with(App.getAppContext()).load(mImgs.get(position))
        .apply(requestOptions).into(viewHolder.imgIcon
);