Image Bubble
CometChatImageBubble
is the content view for a MediaMessage if the media sent is an image.
Methods
Methods | Parameters | Description |
---|---|---|
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.
Methods | Type | Description |
---|---|---|
setTextAppearance | @StyleRes int | used to set style of the caption text |
setBackground | @ColorInt int | used to set background color |
setBackground | Drawable | used to set a gradient background |
setBorderWidth | int | used to set border |
setCornerRadius | float | used to set border radius |
Usage
- XML
<com.cometchat.chatuikit.shared.views.CometChatImageBubble.CometChatImageBubble
android:id="@+id/image_bubble"
android:layout_width="228dp"
android:layout_height="168dp" />
- Java
- Kotlin
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);
val 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)