TUIKit APIs (Android)

Last updated: 2021-01-06 11:24:04


    ConversationLayout consists of TitleBarLayout and ConversationListLayout. Each component provides UI styles and event registration APIs for customization.

    API Description
    getConversationList Obtains the conversation list.
    setConversationTop Pins a conversation on top.
    deleteConversation Deletes a conversation.


    ChatLayout provides features such as message display and sending. Its user interface consists of the following four components, listed from the top down, and each component provides various methods to meet customization requirements.

    • TitleBarLayout
    • NoticeLayout
    • MessageLayout
    • InputLayout
    API Description
    getInputLayout Obtains the layout of the input area (InputLayout).
    getMessageLayout Obtains the layout of the message area (MessageLayout).
    getNoticeLayout Obtains the layout of the message area in the chat window (NoticeLayout).
    setChatInfo Sets the current conversation ID, based on which the conversation panel loads relevant information required for the conversation, such as message records and user (group) information.
    exitChat Quits a chat and releases relevant resources (this API is often invoked when an activity is finished.)
    initDefault Initializes parameters.
    loadMessages Loads chat messages.
    sendMessage Sends messages.


    NoticeLayout has a fixed position and is either displayed or hidden. When you scroll through chat content, its position remains unchanged. NoticeLayout can display group messages or broadcasts to be processed. Its layout is divided into two parts, which can be used to display the content topic and the auxiliary topic, respectively. You can set click events to respond to user operations.

    API Description
    getContent Obtains the topic information of a notice.
    getContentExtra Obtains the further operations of a notice.
    setOnNoticeClickListener Sets click events for a notice.
    alwaysShow Sets whether NoticeLayout is constantly displayed.


    MessageLayout is inherited from RecyclerView and displays messages. It provides many methods to meet customization requirements, such as appearance settings, click events, and custom message display.

    Setting the profile photo

    API Description
    setAvatar Sets the default profile photo. By default, profile photos on the left and right are the same.
    getAvatar Obtains the default profile photo.
    setAvatarRadius Sets the border-radius of the profile photo.
    getAvatarRadius Obtains the border-radius of the profile photo.
    setAvatarSize Sets the profile photo size.
    getAvatarSize Obtains the profile photo size.

    Setting the nickname style

    API Description
    setNameFontSize Sets the nickname font size.