Addition to the answer by Anton Bevza
Their library has some disadvantages that are fixed in the fork
Add dependency in app.gradle:
implementation 'com.github.martipello:MultiImageView:1.0.8.2'
Add MultiImageView to layout xml file
<com.sealstudios.multiimageview.MultiImageView
android:id="@+id/iv"
android:layout_width="100dp"
android:layout_height="100dp"
app:shape="circle" />
For setting shape of MultiImageView use attributes in layout xml file
app:shape="circle" //Circle
app:shape="rectangle" //Rectangle with round corners
app:shape="none" //Without shape
Also you can change shape by using method:
multiImageView.setShape(MultiImageView.Shape.RECTANGLE);//Rectangle with round corners
multiImageView.setShape(MultiImageView.Shape.CIRCLE);//Circle
multiImageView.setShape(MultiImageView.Shape.NONE);//Without shape
In java class find view by id:
final MultiImageView multiImageView = findViewById(R.id.iv);
For adding image to MultiImageView use method addImage(Bitmap bitmap). For example:
multiImageView.addImage(BitmapFactory.decodeResource(getResources(), R.drawable.avatar));
//or
Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), ImageUri);
multiImageView.addImage(bitmap);