tencent cloud

Extension Button List for the More Menu
Last updated: 2025-07-04 17:33:28
Extension Button List for the More Menu
Last updated: 2025-07-04 17:33:28
When a user triggers the tap event for the More button, a list of optional extension buttons will pop up, as illustrated in the default list below:

By overriding the getMoreItems method in the MiniAppProxy class, you can customize the list of extension buttons for the More menu.
API description:
The getMoreItems method's return value represents the customized list of extension buttons.
Parameters MoreItemList.Builder is used to add extension buttons, and the display order of the buttons will match the order in which they are added.
MoreItem’s ID property is used to distinguish between buttons and must be unique.
/**
* Returns the buttons for the capsule's More panel. The IDs for extension buttons must be set within the range of [100, 200]; otherwise, the addition will be invalid.
* Calling environment: Subprocess
*
* @param builder
* @return
*/
public abstract ArrayList<MoreItem> getMoreItems(MoreItemList.Builder builder);

Warning:
The IDs for extension buttons must be set within the range of [100, 200]; otherwise, the addition will be invalid.
Example:
@Override
public ArrayList<MoreItem> getMoreItems(IMiniAppContext miniAppContext, MoreItemList.Builder builder) {
MoreItem item1 = new MoreItem();
// Set the menu ID (required), the ID for extension buttons must be within the range of [100, 200]; otherwise, the addition will be invalid.
item1.id = ShareProxyImpl.OTHER_MORE_ITEM_1;
// Set the menu title (optional)
item1.text = getString(miniAppContext, R.string.applet_mini_proxy_impl_other1);
// Set the menu icon (optional)
item1.drawable = R.mipmap.mini_demo_about;
// Set the visual accessibility description (optional). Defaults to the menu title.
item2.contentDescription = "Visual accessibility description for the menu";
// Listen for tap events
item2.onClickListener = new MoreItem.MoreItemClickListener() {
@Override
public void onClick(IMiniAppContext context, MoreItem item) {
// Handle tap event
}
};

// Adjust the order as needed
builder.addMoreItem(item1)
// Add built-in menu items as needed
.addRestart(getString(miniAppContext, R.string.applet_mini_proxy_impl_restart),
R.mipmap.mini_demo_restart_miniapp)
// Add built-in menu items as needed
.addAbout(getString(miniAppContext, R.string.applet_mini_proxy_impl_about),
R.mipmap.mini_demo_about)
// Add built-in menu items as needed
.addSetting(getString(miniAppContext, R.string.mini_sdk_more_item_setting_0),
R.drawable.mini_sdk_setting,
// Set the visual accessibility description (optional). Defaults to the menu title.
"Mini program settings");
return builder.build();
}

private String getString(IMiniAppContext miniAppContext, int id) {
return miniAppContext.getContext().getString(id);
}




Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback