The solution is pretty simple actually, but yet hasn't been suggested that much.
A few months ago I was searching for a simple solution to get a rounded ImageView, and all I could be able to find was complicated solutions.
I'm writing this answer, since this is not known by everybody (and this solution has been implemented in Android at the end of 2020), so that if someone new to Android Studio will have the same question will be able to quickly find a simple solution to make any ImageView rounded.
First thing first, since the solution is implemented in an androidx library, you should make sure that you're declaring this dependency in your gradle:
dependencies {
//...
implementation "androidx.constraintlayout:constraintlayout:2.0.4"
}
After syncing your gradle, you will be able to use a component called "ImageFilterView".
ImageFilterView is sub-class of ImageView, so it inherits everything from a common ImageView, but there are a few things added in order to manipulate the image.
Among these new things, there is the attribute "roundPercent" which allows you to set how much the corners of the image should be rounded.
Remember that this is a percentage value, so it must be a float between 0.0 and 1.0 included.
Settings this attribute to 1.0 will make the image totally circular.
That's all, nothing else to do, this will be enough to get a rounded ImageView:
<androidx.constraintlayout.utils.widget.ImageFilterView
app:roundPercent = 1.0 />
(Remember that you have to define the "app" namespace at the beginning of the first layout of your xml file in order to be able to use it:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- ... -->
</layout>