Skip to content

AvatarGroup

Version 0.5.4

You can use AvatarGroup component to display avatars as a group.

Quick start

Version 0.5.4

<com.ave.vastgui.tools.view.avatar.AvatarGroup
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

    <com.ave.vastgui.tools.view.avatar.Avatar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <com.ave.vastgui.tools.view.avatar.Avatar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

    <com.ave.vastgui.tools.view.avatar.Avatar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
</com.ave.vastgui.tools.view.avatar.AvatarGroup>

Default style

Overlap from

Version 0.5.4

The coverage direction of the avatars with overlapFrom can be set by avatar_overlap_from or calling setOverlapFrom .

mBinding.avatarGroupStart.setOverlapFrom(AvatarGroup.END)
<com.ave.vastgui.tools.view.avatar.AvatarGroup
    ...
    app:avatar_overlap_from="end">

    ... // Avatar

</com.ave.vastgui.tools.view.avatar.AvatarGroup>

Avatar Group Start Avatar Group End

Overlap width

Version 0.5.4

The width can be set by avatar_overlap_distance or calling setOverlapDistance .

mBinding.avatarGroupStart.setOverlapDistance(20f.DP)
<com.ave.vastgui.tools.view.avatar.AvatarGroup
    ...
    app:avatar_overlap_distance="20dp">

    ... // Avatar

</com.ave.vastgui.tools.view.avatar.AvatarGroup>

Avatar Distance Original Avatar Distance 20dp

Add Avatar

Version 0.5.4

  1. Create Avatar

    val mAvatar = Avatar(this).apply {
        setAvatar(R.drawable.img_avatar_1)
    }
    
  2. Add avatar by addView

    mBinding.avatarGroupStart.addView(
        mAvatar, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
    )
    

AvatarGroup Add Avatar

Sample code

Sample code