AvatarGroup¶
You can use AvatarGroup
component to display avatars as a group.
Quick start¶
<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>
Overlap from¶
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>
Overlap width¶
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>
Add Avatar¶
-
Create
Avatar
val mAvatar = Avatar(this).apply { setAvatar(R.drawable.img_avatar_1) }
-
Add avatar by
addView
mBinding.avatarGroupStart.addView( mAvatar, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) )