stream-chat-android icon indicating copy to clipboard operation
stream-chat-android copied to clipboard

Unable to change/set UserAvatarView scale type

Open Testtaccount opened this issue 2 years ago • 3 comments

Describe the bug Currently I cant make UserAvatarView scaled center cropped

SDK version

  • 6.0.4

To Reproduce Steps to reproduce the behavior:

  1. Go to 'ChannelListView.'

Expected behavior There should be option to set preferred scale type by styles or by attribute, and also I think default scale type of UserAvatarView must be ScaleType.CENTER_CROP.

Device:

  • Vendor and model: Pixel 7
  • Android version: 13

Screenshots photo_5298792146708581507_y

Testtaccount avatar Oct 19 '23 13:10 Testtaccount

Any updates?

Testtaccount avatar Dec 13 '23 09:12 Testtaccount

Hello @Testtaccount Currently the UserAvatarView doesn't expose this attribute, but you should be able to provide a custom UserAvatarRenderer and set ScaleType.CENTER_CROP to the target. Something like:

ChatUI.userAvatarRenderer = UserAvatarRenderer { _, user, target ->
    target.scaleType = ImageView.ScaleType.CENTER_CROP
    target.setAvatar(avatar = user.image)
}

JcMinarro avatar Jul 02 '24 14:07 JcMinarro