# AvatarView

Previously, `AvatarView` was used for both users and channels.
In the new SDK v6, we have separated it into `UserAvatarView` and `ChannelAvatarView`, aligning it more closely with the Compose version.

`ChannelAvatarView` internally utilizes `UserAvatarView` and provides a more robust and straightforward approach for handling different varieties of showing the channel's avatar.

## XML Changes

This change will require you to update your layout XML files in case you have directly used `AvatarView` there.

Whenever you've used `AvatarView` for a user, you will need to change it to `UserAvatarView`:

```java
Was: io.getstream.chat.android.ui.avatar.AvatarView
Now: io.getstream.chat.android.ui.avatar.UserAvatarView
```

Similar action is required for channels:

```java
Was: io.getstream.chat.android.ui.avatar.AvatarView
Now: io.getstream.chat.android.ui.avatar.ChannelAvatarView
```

<admonition type="note">

The `avatar_user.xml` layout file has been replaced with two separate files: `view_channel_avatar.xml` and `view_user_avatar.xml`.

</admonition>

## Code Changes

If you were using `AvatarView` in your code, you will need to change it to `UserAvatarView` or `ChannelAvatarView` depending on your use case.
Additionally, you will need to pass the `User` or `Channel` object to the view in a slightly different manner.

### UserAvatarView

Here is an example of how to use `UserAvatarView`:

```java
Was: avatarView.setUserData(user)
Now: userAvatarView.setUser(user)
```

### ChannelAvatarView

Here is an example of how to use `ChannelAvatarView`:

```java
Was: avatarView.setChannelData(channel)
Now: channelAvatarView.setChannel(channel)
```

### AvatarBitmapFactory

Due to the deletion of `AvatarBitmapFactory`, the `avatarBitmapFactory` property was removed from ChatUI.
This change happened because `ChannelAvatarView` is now responsible for combining child views to deliver a unified experience of merged avatars.

```java
Deleted: io.getstream.chat.android.ui.avatar.AvatarBitmapFactory
```

### Customization

With the new version we have also added some extra attributes for better customization of `ChannelAvatarView`:

```xml
<!-- Text size of the AvatarView's initials letters in group avatar -->
<attr name="streamUiGroupAvatarTextSize" format="dimension|reference" />
<!-- A color of the AvatarView's initials letters in group avatar -->
<attr name="streamUiGroupAvatarTextColor" format="color|reference" />
<!-- Font name of the AvatarView's initials letters in group avatar -->
<attr name="streamUiGroupAvatarTextFont" format="reference" />
<!-- Font assets reference for the AvatarView's initials letters in group avatar -->
<attr name="streamUiGroupAvatarTextFontAssets" format="string" />
<!-- Text style of the AvatarView's initials letters in group avatar -->
<attr name="streamUiGroupAvatarTextStyle">
    <flag name="normal" value="0" />
    <flag name="bold" value="1" />
    <flag name="italic" value="2" />
</attr>
```

`AvatarStyle` has been changed accordingly.<br />
In the previous version, `AvatarStyle` was exposing a single avatarInitialText text styling.
However, in the new SDK v6, this has been separated into `avatarInitialsTextStyle` and `groupAvatarInitialsTextStyle`, providing better customizability.

#### _Was_

```kotlin
public data class AvatarStyle(
    //...
    public val avatarInitialText: TextStyle,
    //...
)
```

#### _Now_

```kotlin
public data class AvatarStyle(
    //...
    public val avatarInitialsTextStyle: TextStyle,
    public val groupAvatarInitialsTextStyle: TextStyle,
    //...
)
```

### Other Imports

This change might also require you to update some other imports as well:

```java
Was: io.getstream.chat.android.ui.avatar.AvatarStyle
Now: io.getstream.chat.android.ui.widgets.avatar.AvatarStyle

Was: io.getstream.chat.android.ui.avatar.AvatarView.OnlineIndicatorPosition
Now: io.getstream.chat.android.ui.widgets.avatar.OnlineIndicatorPosition

Was: io.getstream.chat.android.ui.avatar.AvatarView.AvatarShape
Now: io.getstream.chat.android.ui.widgets.avatar.AvatarShape
```


---

This page was last updated at 2026-04-17T17:33:32.111Z.

For the most recent version of this documentation, visit [https://getstream.io/chat/docs/sdk/android/v6/migration-guides/ui-components/avatar-view/](https://getstream.io/chat/docs/sdk/android/v6/migration-guides/ui-components/avatar-view/).