'ImageView with rounded corners in Kotlin

I want to have an ImageView with rounded corners in my Fragment. I've got the following Kotlin code:

val imageView: ImageView = root.findViewById(R.id.profile_view)
val pv = RoundedBitmapDrawableFactory.create(res, src)
pv.setCornerRadius = 0f
imageView.setImageDrawable(pv)

create and res are red underlined by Android Stuido. create says:

None of the following functions can be called with the following arguments supplied: - Bitmap? - InputStream - String

res says:

Expression expected, but a package name found.

I hope somebody can help me to fix that problem.

Regards, Jeremy



Solution 1:[1]

You can easily do it using the Glide library.

Glide.with(imageView.context)
            .load(pictureUri)
            .apply(
                RequestOptions()
                    .transform(RoundedCorners(25))
            .into(imageView)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 extremeoats