Friend List Page
tip
This feature is supported starting from version 5.12.0.
Friend List Page Overview
The FriendList
page displays all friends of the current user and supports features like search and viewing friend details. Below are detailed descriptions of the components related to the FriendList
page:
- FriendListActivity: Serves as the container class for the friend list page, responsible for loading and displaying
FriendListFragment
. - FriendListFragment: The core component of the friend list page, responsible for displaying UI elements such as the friend list and search box, and handling user input and interactions.
- FriendListViewModel: Handles data and business logic, retrieves the friend list data, and passes it to
FriendListFragment
. - XML Layout File:
rc_page_friend_list.xml
Page Structure
The friend list page typically includes main components such as a navigation bar, search box, and contact list.

Customization
The friend list page provided by IMKit supports custom styling.
Launching the Friend List Page
startActivity(FriendListActivity.newIntent(this));
Customization
For details, refer to the User Profile Hosting Page Design section on custom fragments.
Customization includes the title, search box click events, friend request click events, and contact friend click events.
// Custom CustomFriendListFragment
public class CustomFriendListFragment extends FriendListFragment {
@Override
protected void onViewReady(@NonNull FriendListViewModel viewModel) {
super.onViewReady(viewModel);
// Change the title text
headComponent.setTitleText("New Title");
// Override the back button click event in the title bar
headComponent.setLeftClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
// Override the friend request click event
headComponent.setRightClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
// Set the icon for the right button in the title bar
headComponent.setRightTextDrawable(R.drawable.rc_right_icon);
// Override the search click event
searchComponent.setSearchClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
// Set the contact list click event
contactListComponent.setOnContactClickListener(new OnContactClickListener() {
@Override
public void onContactClick(ContactModel contactModel) {
}
});
}
}