Skip to main content
Version: v4

Image Bubble

CometChatImageBubble is the content view for a MediaMessage if the media sent is an image.

Methods

MethodsParametersDescription
setImageUrl(String url, @DrawableRes int placeHolderImage, boolean isGif)It used to set image url which to be rendered in image bubble
setCaption(String caption)a text to display below the image
setStyle(ImageBubbleStyle style)used to customize appearance of this widget
setOnClick(OnClick onClick)custom action on tapping the image

ImageBubbleStyle

ImageBubbleStyle is the class containing attributes to customize appearance of this widget.

MethodsTypeDescription
setTextAppearance@StyleRes

int
used to set style of the caption text
setBackground@ColorInt

int
used to set background color
setBackgroundDrawableused to set a gradient background
setBorderWidthintused to set border
setCornerRadiusfloatused to set border radius

Usage

<com.cometchat.chatuikit.shared.views.CometChatImageBubble.CometChatImageBubble
android:id="@+id/image_bubble"
android:layout_width="228dp"
android:layout_height="168dp" />
CometChatImageBubble cometChatImageBubble=view.findViewById(R.id.image_bubble);

cometChatImageBubble.setImageUrl("https://images.pexels.com/photos/1496372/pexels-photo-1496372.jpeg",R.drawable.black_placeholder,false);