java - Android - combine multiple images into one ImageView -


i'm looking developing (or library) can allow me merge multiple images 1 imageview.

my application grouping interactions between users, instead of displaying them singularly, , therefore merge of avatars, 1 adapter cell visualizes "group".

a fantastic example of done on facebook.com's chat such:

image showing combined avatars

my question is, how can provide functionality in android / java? presumably, number of images between 1 , 4. please let me know of advice can give :)

you can use multiimageview.

add dependency in app.gradle:

compile 'com.github.stfalcon:multiimageview:0.1' 

add multiimageview layout xml file

<com.stfalcon.multiimageview.multiimageview     android:id="@+id/iv"     android:layout_width="100dp"     android:layout_height="100dp"/> 

in java class find view id:

final multiimageview multiimageview = (multiimageview) findviewbyid(r.id.iv); 

for adding image multiimageview use method addimage(bitmap bitmap). exapple:

multiimageview.addimage(bitmapfactory.decoderesource(getresources(), r.drawable.avatar1)); 

for setting shape of multiimageview use method setshape(multiimageview.shape shape).

multiimageview.setshape(multiimageview.shape.rectangle);//rectangle round corners multiimageview.setshape(multiimageview.shape.circle);//circle multiimageview.setshape(multiimageview.shape.none);//without shape 

enter image description here
check github link more information:

i think needed


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -