Message Reply with Quote
IMKit supports the message reply with quote feature, allowing users to reply to each other's messages in the chat UI. The message will appear in the message list component of the conversation page. By default, the quoted reply feature sends messages containing the quoted message content object ReferenceMessage (type identifier: RC:ReferenceMsg
).


Limitations
The message reply with quote feature currently has the following limitations:
- Only supports quoting text messages, file messages, graphic messages, image messages, and reference messages.
- Supports only one level of nesting—you can only quote the original message. For nested quotes, only the immediately preceding quoted message content will be displayed.
- If the quoted message is recalled, the reply message will still display the quoted content.
Usage
The message reply with quote feature is enabled by default in IMKit conversation pages. Users can long-press a message in the conversation page, select Quote Message from the pop-up menu, and then quote the message. After adding content to the input area, the SDK will automatically combine the input content with the quoted message into a ReferenceMessage and send it to the conversation.
Disabling the Quoted Reply Feature
IMKit 5.X does not support disabling this feature by modifying XML resource files. To disable the quoted reply feature, modify the IMKit global configuration:
Call after initialization.
RongConfigCenter.featureConfig().enableReference(false);
Customizing the UI for Quoted Messages
By default, the quoted reply feature sends messages containing the quoted message content (RC:ReferenceMsg
), which is displayed in the message list using the ReferenceMessageItemProvider
template.
All message display templates inherit from BaseMessageItemProvider<CustomMessage>
. You can inherit BaseMessageItemProvider<CustomMessage>
to implement your own quoted message display template class and provide it to the SDK.
Alternatively, you can directly replace the style resources, string resources, and icon resources referenced in the quoted message display template. For details, refer to the resources referenced in the IMKit source code ReferenceMessageItemProvider.java.
For example: You can copy the entire content of rc_item_reference_message.xml from the IMKit source code and create a /res/layout/rc_item_reference_message.xml
file in your project to modify the defined style values. Do not remove SDK default controls or arbitrarily change View IDs.